Skip to content

Commit

Permalink
fix: rename input to xsh for shell usage
Browse files Browse the repository at this point in the history
  • Loading branch information
JanPokorny committed Oct 10, 2024
1 parent d4dbceb commit dd4702d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion executor/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ async fn execute(payload: web::Json<ExecuteRequest>) -> Result<HttpResponse, Err
.output()
.await?;
}

tokio::fs::rename(source_dir.path().join("script.py"), source_dir.path().join("script.xsh")).await?;

let timeout = Duration::from_secs(payload.timeout.unwrap_or(60));
let (stdout, stderr, exit_code) = tokio::time::timeout(
timeout,
Command::new("xonsh") // TODO: manually switch between python and shell for ~80ms perf gain
.arg(source_dir.path().join("script.py"))
.arg(source_dir.path().join("script.xsh"))
.output(),
)
.await
Expand Down

0 comments on commit dd4702d

Please sign in to comment.