Skip to content

Commit 2356cc0

Browse files
author
Andrew
committed
fixed command not found error
1 parent edbe54b commit 2356cc0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dsc_lib/src/dscresources/command_resource.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,12 @@ async fn run_process_async(executable: &str, args: Option<Vec<String>>, input: O
578578
command.env_remove("DEBUG_DSC");
579579
}
580580

581-
let mut child = command.spawn().expect("failed to spawn command");
581+
let mut child = match command.spawn() {
582+
Ok(c) => c,
583+
Err(e) => {
584+
return Err(DscError::CommandOperation(e.to_string(), executable.to_string()))
585+
}
586+
};
582587

583588
let stdout = child.stdout.take().expect("child did not have a handle to stdout");
584589
let stderr = child.stderr.take().expect("child did not have a handle to stderr");
@@ -646,6 +651,7 @@ async fn run_process_async(executable: &str, args: Option<Vec<String>>, input: O
646651
Err(DscError::CommandOperation("Process terminated by signal".to_string(), executable.to_string()))
647652
}
648653
}
654+
649655
/// Invoke a command and return the exit code, stdout, and stderr.
650656
///
651657
/// # Arguments

0 commit comments

Comments
 (0)