diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-02-24 15:53:52 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-02-24 15:53:52 -0600 |
commit | 63bea8a6ef52aac31b6664f31be7044a2e322a2c (patch) | |
tree | a0421995f619c8fcefbb46385982269eea0072ad /src/routes | |
parent | Make the program not output an error when there isn't one (diff) | |
download | ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar.gz ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar.bz2 ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar.lz ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar.xz ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.tar.zst ee4511w-web-63bea8a6ef52aac31b6664f31be7044a2e322a2c.zip |
Allow csv to be downloaded even if the program exits with an error
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/api.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/routes/api.ts b/src/routes/api.ts index fd1ee38..ee80ea5 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -133,10 +133,10 @@ api.route('/actuate') stderr += `STDERR: ${data.toString()}`; }); actuation.on('close', (code: number) => { + const filename: string = (req.body.file.path as string).split('/').pop() as string; // Make sure the program exited with a code of 0 (success) if (code !== 0) - return res.status(500).json({ error: `Program exited with exit code ${code}`, error_msg: stderr }); - const filename: string = (req.body.file.path as string).split('/').pop() as string; + return res.status(500).json({ error: `Program exited with exit code ${code}`, error_msg: stderr, file: { name: req.body.file.file, filename: filename } }); return res.status(200).json({ file: { name: req.body.file.file, filename: filename } }); }); // Kill the process if it takes too long |