-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand-wrapper.rs
More file actions
34 lines (32 loc) · 923 Bytes
/
Copy pathcommand-wrapper.rs
File metadata and controls
34 lines (32 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::{
env::{args_os, current_exe},
fs,
process::Command,
};
fn main() -> ! {
let file = fs::canonicalize(current_exe().expect("Couldn't get `current_exe()`"))
.expect("Couldn't canonicalize exe path")
.with_extension("");
let mut command = Command::new("py");
command.arg(file);
for arg in args_os().skip(1) {
command.arg(arg);
}
let status = command.status().expect("Couldn't spawn command process");
std::process::exit(match status.code() {
Some(code) => code,
None => cfg_select! {
unix => {
{
use std::os::unix::process::ExitStatusExt;
if let Some(signal) = status.signal() {
128 + signal
} else {
-1
}
}
}
_ => -1,
},
})
}