improve bash output buffering

This commit is contained in:
Ruben Fiszel
2023-04-18 01:42:28 +02:00
parent dbd0dc1aa9
commit 26a86ba0d8
3 changed files with 3 additions and 3 deletions
@@ -268,7 +268,7 @@ fn tstype_to_typ(ts_type: &TsType) -> (Typ, bool) {
pub fn eval_sync(code: &str) -> Result<serde_json::Value, String> {
let mut context = JsRuntime::new(RuntimeOptions::default());
let code = format!("let x = {}; x", code);
let res = context.execute_script("<anon>", code);
let res = context.execute_script("<anon>", code.into());
match res {
Ok(global) => {
let scope = &mut context.handle_scope();
+1 -1
View File
@@ -252,7 +252,7 @@ async function resource(path) {{
.join(""),
);
tracing::debug!("{}", code);
let global = context.execute_script("<anon>", code)?;
let global = context.execute_script("<anon>", code.into())?;
let global = context.resolve_value(global).await?;
let scope = &mut context.handle_scope();
+1 -1
View File
@@ -1181,7 +1181,7 @@ async fn handle_bash_job(
) -> Result<serde_json::Value, Error> {
logs.push_str("\n\n--- BASH CODE EXECUTION ---\n");
set_logs(logs, &job.id, db).await;
write_file(job_dir, "main.sh", &format!("{content}\necho \"\"\nsync\necho \"\"")).await?;
write_file(job_dir, "main.sh", &format!("{content}\nsleep 0.02")).await?;
let token = client.get_token().await;
let mut reserved_variables = get_reserved_variables(job, &token, db).await?;
reserved_variables.insert("RUST_LOG".to_string(), "info".to_string());