mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Go back to matching on bool since it was more obvious
This commit is contained in:
parent
3c3a798fbb
commit
af3d022f5d
2 changed files with 7 additions and 6 deletions
|
@ -132,12 +132,15 @@ async fn process_spawn(lua: &Lua, (program, args): (String, Option<Vec<String>>)
|
|||
.wait_with_output()
|
||||
.await
|
||||
.map_err(mlua::Error::external)?;
|
||||
// NOTE: Exit code defaults to 1 if it did not exist and if there
|
||||
// is any stderr, will otherwise default to 0 if it did not exist
|
||||
// NOTE: If an exit code was not given by the child process,
|
||||
// we default to 1 if it yielded any error output, otherwise 0
|
||||
let code = output
|
||||
.status
|
||||
.code()
|
||||
.unwrap_or_else(|| i32::from(!output.stderr.is_empty()));
|
||||
.unwrap_or(match output.stderr.is_empty() {
|
||||
true => 0,
|
||||
false => 1,
|
||||
});
|
||||
// Construct and return a readonly lua table with results
|
||||
let table = lua.create_table()?;
|
||||
table.raw_set("ok", code == 0)?;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![deny(clippy::all, clippy::cargo, clippy::pedantic)]
|
||||
// mlua does not implement userdata for &str
|
||||
// so in some cases we have to use String
|
||||
#![allow(clippy::needless_pass_by_value)]
|
||||
#![allow(clippy::needless_pass_by_value, clippy::match_bool)]
|
||||
|
||||
use clap::Parser;
|
||||
use mlua::Result;
|
||||
|
|
Loading…
Reference in a new issue