fix: improve ts wrappers (#3163)

This commit is contained in:
HugoCasa
2024-02-06 17:54:32 +01:00
committed by GitHub
parent 5c3ec3c5fb
commit b52fc09098
2 changed files with 17 additions and 5 deletions
+13 -3
View File
@@ -483,7 +483,9 @@ async function run() {{
await fs.writeFile("result.json", res_json);
process.exit(0);
}}
run().catch(async (e) => {{
try {{
await run();
}} catch(e) {{
let err = {{ message: e.message, name: e.name, stack: e.stack }};
let step_id = process.env.WM_FLOW_STEP_ID;
if (step_id) {{
@@ -491,7 +493,7 @@ run().catch(async (e) => {{
}}
await fs.writeFile("result.json", JSON.stringify(err));
process.exit(1);
}});
}}
"#,
);
write_file(job_dir, "wrapper.ts", &wrapper_content).await?;
@@ -707,7 +709,15 @@ plugin(p)
.stderr(Stdio::piped());
bun_cmd
};
start_child_process(cmd, &*BUN_PATH).await?
start_child_process(
cmd,
if annotation.nodejs_mode {
&*NODE_PATH
} else {
&*BUN_PATH
},
)
.await?
};
handle_child(
+4 -2
View File
@@ -223,7 +223,9 @@ async function run() {{
await Deno.writeTextFile("result.json", res_json);
Deno.exit(0);
}}
run().catch(async (e) => {{
try {{
await run();
}} catch(e) {{
let err = {{ message: e.message, name: e.name, stack: e.stack }};
let step_id = Deno.env.get("WM_FLOW_STEP_ID");
if (step_id) {{
@@ -231,7 +233,7 @@ run().catch(async (e) => {{
}}
await Deno.writeTextFile("result.json", JSON.stringify(err));
Deno.exit(1);
}});
}}
"#,
);
write_file(job_dir, "wrapper.ts", &wrapper_content).await?;