Skip to content

Commit

Permalink
Fix spawn error message logic
Browse files Browse the repository at this point in the history
  • Loading branch information
agrawal-d committed Aug 13, 2020
1 parent 0e41f0f commit 65a1560
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/runs/executions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,27 @@ export const runTestCase = (
}, getTimeOutPref());

// Start the binary or the interpreter.
try {
switch (language.name) {
case 'python': {
process = spawn(
language.compiler, // 'python3' or 'python' TBD
[binPath, ...language.args],
spawnOpts,
);
break;
}
default: {
process = spawn(binPath, spawnOpts);
}
switch (language.name) {
case 'python': {
process = spawn(
language.compiler, // 'python3' or 'python' TBD
[binPath, ...language.args],
spawnOpts,
);
break;
}
default: {
process = spawn(binPath, spawnOpts);
}
} catch (err) {
vscode.window.showErrorMessage('Could not spawn testcase process.\n');
throw err;
}

process.on('error', (err) => {
console.error(err);
vscode.window.showErrorMessage(
`Could not launch testcase process. Is '${language.compiler}' in your PATH?`,
);
});

const begin = Date.now();
const ret: Promise<Run> = new Promise((resolve) => {
runningBinaries.push(process);
Expand Down

0 comments on commit 65a1560

Please sign in to comment.