Fix an issue which-in the service doesn't die when `../data/distwrite` doesn't exist. (#279)

Run RustFmt.
This commit is contained in:
Sagi Sarussi 2021-02-03 18:18:38 +02:00 committed by GitHub
parent 7f438ca6d6
commit 0693624dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,3 @@
use bastion::prelude::*;
#[cfg(not(target_os = "windows"))]
use futures::*;
#[cfg(not(target_os = "windows"))]
use std::fs::File;
use std::fs::OpenOptions;
@ -9,6 +6,11 @@ use std::io::Write;
use std::path::PathBuf;
use std::sync::Arc;
#[cfg(not(target_os = "windows"))]
use futures::*;
use bastion::prelude::*;
///
/// Parallel (MapReduce) job which async writes results to a single output file
///
@ -51,7 +53,6 @@ fn main() {
// Get a shadowed sharable reference of workers.
let workers = Arc::new(workers);
//
// Mapper that generates work.
Bastion::children(|children: Children| {
children.with_exec(move |ctx: BastionContext| {
@ -63,6 +64,11 @@ fn main() {
path.push("data");
path.push("distwrite");
if !path.exists() || !path.is_file() {
Bastion::stop();
panic!("The file could not be opened.");
}
let fo = OpenOptions::new()
.read(true)
.write(true)