Skip to content

Commit 8026833

Browse files
committed
remove trailing newline from stderr
1 parent 07ada49 commit 8026833

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/executor.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const uniqueFilename = require("unique-filename");
1010
*
1111
* @param input The code that should be executed
1212
* @param language Language of the input parameter
13-
* @param args Array of arguments to run the code
14-
* @param options Options Parameter
1513
* @returns Result of the code
1614
*/
1715
export default async function execute(
@@ -53,7 +51,11 @@ export default async function execute(
5351
// Delete created file
5452
unlinkSync(temppath);
5553

56-
if (stderr) return reject(stderr);
54+
if (stderr) {
55+
// Remove newline from stderr
56+
if (stderr.endsWith("\n")) stderr = stderr.slice(0, -1);
57+
return reject(stderr);
58+
}
5759

5860
// Remove newline from stdout
5961
if (stdout.endsWith("\n")) stdout = stdout.slice(0, -1);

0 commit comments

Comments
 (0)