mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Fix a REPL booting bug
This commit is contained in:
parent
6d7c20fa99
commit
8708c2e5d3
5 changed files with 53 additions and 7 deletions
|
@ -111,3 +111,20 @@ pub fn exec_py(code: &str) -> Option<i32> {
|
|||
};
|
||||
child.wait().expect("python doesn't work").code()
|
||||
}
|
||||
|
||||
pub fn spawn_py(code: &str) {
|
||||
if cfg!(windows) {
|
||||
Command::new(which_python())
|
||||
.arg("-c")
|
||||
.arg(code)
|
||||
.spawn()
|
||||
.expect("cannot execute python");
|
||||
} else {
|
||||
let python_command = format!("{} -c \"{}\"", which_python(), code);
|
||||
Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(python_command)
|
||||
.spawn()
|
||||
.expect("cannot execute python");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue