mirror of https://github.com/bastion-rs/bastion
Fix an issue which-in the service doesn't die when `../data/distwrite` doesn't exist. (#279)
Run RustFmt.
This commit is contained in:
parent
7f438ca6d6
commit
0693624dc8
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue