mu-file-utils: add run_command0

To ensure command ran and had exit-code=0 in one go.
This commit is contained in:
Dirk-Jan C. Binnema
2023-09-19 22:24:38 +03:00
parent ae87be6a48
commit 24add72126
2 changed files with 19 additions and 5 deletions

View File

@ -227,14 +227,14 @@ Result<std::string> make_temp_dir();
Result<void> remove_directory(const std::string& path);
/**
* Run some system command
* Run some system command.
*
* @param args a list of commmand line arguments (like argv)
* @param try_setsid whether to try setsid(2) (see its manpage for details) if this
* system supports it.
*
* @return Ok(exit code) or an error. Note that exit-code != 0 is _not_
* considered an error from the perspective of this function.
* @return Ok(exit code) or an error. Note that exit-code != 0 is _not_ considered an error from the
* perspective of run_command, but is for run_command0
*/
struct CommandOutput {
int exit_code;
@ -243,6 +243,8 @@ struct CommandOutput {
};
Result<CommandOutput> run_command(std::initializer_list<std::string> args,
bool try_setsid=false);
Result<CommandOutput> run_command0(std::initializer_list<std::string> args,
bool try_setsid=false);
/**
* Try to 'play' (ie., open with it's associated program) a file. On MacOS, the