mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 18:29:00 +00:00
test: add a mock test for the REPL server
This commit is contained in:
parent
03a30a450a
commit
5536858363
3 changed files with 52 additions and 4 deletions
|
@ -738,15 +738,14 @@ pub fn _eval_pyc<S: Into<String>>(file: S, py_command: Option<&str>) -> String {
|
|||
String::from_utf8_lossy(&out.stdout).to_string()
|
||||
}
|
||||
|
||||
pub fn _exec_py(code: &str) -> Option<i32> {
|
||||
pub fn exec_py(file: &str) -> Option<i32> {
|
||||
let mut child = if cfg!(windows) {
|
||||
Command::new(which_python())
|
||||
.arg("-c")
|
||||
.arg(code)
|
||||
.arg(file)
|
||||
.spawn()
|
||||
.expect("cannot execute python")
|
||||
} else {
|
||||
let exec_command = format!("{} -c \"{}\"", which_python(), code);
|
||||
let exec_command = format!("{} {file}", which_python());
|
||||
Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(exec_command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue