|
@@ -11,7 +11,7 @@ use std::{
|
|
|
str::FromStr,
|
|
|
sync::{
|
|
|
atomic::{AtomicBool, Ordering},
|
|
|
- mpsc::channel,
|
|
|
+ mpsc::{channel, sync_channel},
|
|
|
Arc, Mutex,
|
|
|
},
|
|
|
time::{Duration, Instant},
|
|
@@ -50,6 +50,7 @@ pub struct Options {
|
|
|
pub features: Option<Vec<String>>,
|
|
|
pub args: Vec<String>,
|
|
|
pub config: Option<String>,
|
|
|
+ pub no_watch: bool,
|
|
|
}
|
|
|
|
|
|
impl From<crate::build::Options> for Options {
|
|
@@ -61,6 +62,7 @@ impl From<crate::build::Options> for Options {
|
|
|
features: options.features,
|
|
|
args: options.args,
|
|
|
config: options.config,
|
|
|
+ no_watch: true,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -74,6 +76,7 @@ impl From<crate::dev::Options> for Options {
|
|
|
features: options.features,
|
|
|
args: options.args,
|
|
|
config: options.config,
|
|
|
+ no_watch: options.no_watch,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -215,11 +218,23 @@ impl Interface for Rust {
|
|
|
let on_exit = Arc::new(on_exit);
|
|
|
|
|
|
let on_exit_ = on_exit.clone();
|
|
|
- let child = self.run_dev(options.clone(), move |status, reason| {
|
|
|
- on_exit_(status, reason)
|
|
|
- })?;
|
|
|
|
|
|
- self.run_dev_watcher(child, options, on_exit)
|
|
|
+ if options.no_watch {
|
|
|
+ let (tx, rx) = sync_channel(1);
|
|
|
+ self.run_dev(options, move |status, reason| {
|
|
|
+ tx.send(()).unwrap();
|
|
|
+ on_exit_(status, reason)
|
|
|
+ })?;
|
|
|
+
|
|
|
+ rx.recv().unwrap();
|
|
|
+ Ok(())
|
|
|
+ } else {
|
|
|
+ let child = self.run_dev(options.clone(), move |status, reason| {
|
|
|
+ on_exit_(status, reason)
|
|
|
+ })?;
|
|
|
+
|
|
|
+ self.run_dev_watcher(child, options, on_exit)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|