-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25dccf2
commit 6e65e6a
Showing
13 changed files
with
88 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::process::{Command, Output, Stdio}; | ||
|
||
use std::io::Result; | ||
|
||
pub fn exec(pgm: &str, args: Vec<&str>) -> Result<String> { | ||
log::debug!("IPC: {} {:?}", pgm, args); | ||
let output = Command::new(pgm).args(args).output()?; | ||
string_process_output(output) | ||
} | ||
#[allow(unused)] | ||
pub fn spawn(pgm: &str, args: Vec<&str>) -> Result<()> { | ||
log::debug!("SPW: {} {:?}", pgm, args); | ||
// Just ignore the output, otherwise the ui might be broken | ||
Command::new(pgm) | ||
.stderr(Stdio::null()) | ||
.stdout(Stdio::null()) | ||
.args(args) | ||
.spawn()?; | ||
Ok(()) | ||
} | ||
|
||
fn string_process_output(output: Output) -> Result<String> { | ||
let stdout_str = String::from_utf8(output.stdout).unwrap(); | ||
let stderr_str = String::from_utf8(output.stderr).unwrap(); | ||
|
||
let result_str = format!( | ||
r#" | ||
Status: | ||
{} | ||
Stdout: | ||
{} | ||
Stderr: | ||
{} | ||
"#, | ||
output.status, stdout_str, stderr_str | ||
); | ||
|
||
Ok(result_str) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#![allow(refining_impl_trait)] | ||
mod clashsrvctl; | ||
mod profile; | ||
mod profile_input; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters