[run] Move "once" logic to be entirely within handler

This commit is contained in:
Félix Saparelli 2019-01-27 15:51:49 +13:00
parent 4ceb70f6bf
commit 8eb90738de
1 changed files with 5 additions and 1 deletions

View File

@ -114,7 +114,7 @@ where
}
// Call handler initially, if necessary
if args.run_initially && !args.once {
if args.run_initially {
if !handler.on_manual()? {
return Ok(());
}
@ -182,6 +182,10 @@ impl Handler for ExecHandler {
// Only returns Err() on lock poisoning.
fn on_manual(&mut self) -> Result<bool> {
if self.args.once {
return Ok(true);
}
let cls = self.args.clear_screen;
self.args.clear_screen = false;
self.spawn(&[])?;