From 9d32012bbc5c36a796e9bc027fb73fed610333f8 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Tue, 23 Feb 2021 19:52:49 +1300 Subject: [PATCH] api: write stdin to child process --- api/src/executor/job.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/executor/job.js b/api/src/executor/job.js index 5a51a61..c99ecb9 100644 --- a/api/src/executor/job.js +++ b/api/src/executor/job.js @@ -92,13 +92,16 @@ class Job { gid: this.gid, detached: true //dont kill the main process when we kill the group }); - + + proc.stdin.write(this.stdin); + proc.stdin.end(); const kill_timeout = setTimeout(_ => proc.kill('SIGKILL'), timeout); proc.stderr.on('data', d=>{if(stderr.length>config.output_max_size) proc.kill('SIGKILL'); else stderr += d;}); proc.stdout.on('data', d=>{if(stdout.length>config.output_max_size) proc.kill('SIGKILL'); else stdout += d;}); + function exit_cleanup(){ clearTimeout(kill_timeout); proc.stderr.destroy();