Skip to content

Commit

Permalink
#297: CustomShell: Show an error if binary path is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
Taitava committed Mar 11, 2023
1 parent e44be6e commit d462083
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/shells/CustomShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ export class CustomShell extends Shell {

protected async augmentSpawn(spawnAugmentation: SpawnAugmentation, tShellCommand: TShellCommand | null, scEvent: SC_Event | null): Promise<boolean> {
const debugLogBase = this.constructor.name + ".augmentSpawn(): ";
const shellBinaryPath = this.getBinaryPath();
if ("" === shellBinaryPath.trim()) {
// Shell binary is not specified.
this.plugin.newError("Custom shell " + this.getName() + ": Binary path is not defined.");
return false; // Prevent execution.
}

// Disable Node.js's builtin shell feature.
// CustomShells need to be able to define their own shell invoking command line options, so the Node.js's shell feature would be too limited.
Expand Down Expand Up @@ -202,7 +208,7 @@ export class CustomShell extends Shell {
spawnAugmentation.spawnArguments = parsedShellArguments;

// Tell spawn() to use the shell binary path as an executable command.
spawnAugmentation.shellCommandContent = this.getBinaryPath(); // Needs to come AFTER the original shellCommandContent is taken to spawnArguments!
spawnAugmentation.shellCommandContent = shellBinaryPath; // Needs to come AFTER the original shellCommandContent is taken to spawnArguments!
return true; // Allow execution.
}

Expand Down

0 comments on commit d462083

Please sign in to comment.