mirror of
https://github.com/CompeyDev/lune-packaging.git
synced 2025-01-09 12:19:09 +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()
|
.wait_with_output()
|
||||||
.await
|
.await
|
||||||
.map_err(mlua::Error::external)?;
|
.map_err(mlua::Error::external)?;
|
||||||
// NOTE: Exit code defaults to 1 if it did not exist and if there
|
// NOTE: If an exit code was not given by the child process,
|
||||||
// is any stderr, will otherwise default to 0 if it did not exist
|
// we default to 1 if it yielded any error output, otherwise 0
|
||||||
let code = output
|
let code = output
|
||||||
.status
|
.status
|
||||||
.code()
|
.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
|
// Construct and return a readonly lua table with results
|
||||||
let table = lua.create_table()?;
|
let table = lua.create_table()?;
|
||||||
table.raw_set("ok", code == 0)?;
|
table.raw_set("ok", code == 0)?;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#![deny(clippy::all, clippy::cargo, clippy::pedantic)]
|
#![deny(clippy::all, clippy::cargo, clippy::pedantic)]
|
||||||
// mlua does not implement userdata for &str
|
#![allow(clippy::needless_pass_by_value, clippy::match_bool)]
|
||||||
// so in some cases we have to use String
|
|
||||||
#![allow(clippy::needless_pass_by_value)]
|
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use mlua::Result;
|
use mlua::Result;
|
||||||
|
|
Loading…
Reference in a new issue