-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(windows): Utilize wsl.exe instead of deprecated bash.exe
* feature: Allow usage without installing bashdb * further changes to enable debugging without installing bashdb * some things discovered by shellcheck extension * some readme update * fix for 'examine' and result with multiple spaces * changes related to proper set * fix examine functionality * create GPL licensed folder in source * merge to newest bashdb (master) * print some non-changing variables only at startup (improve performance) * - switch windows to use "bash" instead of full bash exe path - better immidiate window functionality - handle chmod error * prepare for merge * interactive scripting - separate input stream * some fixes related to breakpoint setting * fix from bashdb unit tests * fix for examine - multiple spaces in strings * show command executable location * proper debug console colors * use integrated terminal * remove polling (performance) * Remove deprecated bash exe in windows * fix for pause and stopping * fix for termination
- Loading branch information
Showing
5 changed files
with
74 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ChildProcess, SpawnSyncReturns, spawnSync, spawn } from 'child_process'; | ||
import { getWSLLauncherPath } from './handlePath'; | ||
|
||
export function spawnBashScript(scriptCode: string, pathBash: string, outputHandler?: (output: string) => void): ChildProcess{ | ||
const currentShell = (process.platform === "win32") ? getWSLLauncherPath(false) : pathBash; | ||
const optionalBashPathArgument = (currentShell !== pathBash) ? pathBash : ""; | ||
|
||
let spawnedProcess = spawn(currentShell, [optionalBashPathArgument, "-c", scriptCode].filter(arg => arg !== ""), { stdio: ["pipe", "pipe", "pipe"], shell: false}); | ||
|
||
if (outputHandler) { | ||
spawnedProcess.on("error", (error) => { | ||
outputHandler(`${error}`); | ||
}); | ||
|
||
spawnedProcess.stderr.on("data", (data) => { | ||
outputHandler(`${data}`); | ||
}); | ||
|
||
spawnedProcess.stdout.on("data", (data) => { | ||
outputHandler(`${data}`); | ||
}); | ||
} | ||
|
||
return spawnedProcess; | ||
} | ||
|
||
export function spawnBashScriptSync(scriptCode: string, pathBash: string, spawnTimeout: number): SpawnSyncReturns<Buffer>{ | ||
const currentShell = (process.platform === "win32") ? getWSLLauncherPath(false) : pathBash; | ||
const optionalBashPathArgument = (currentShell !== pathBash) ? pathBash : ""; | ||
|
||
return spawnSync(currentShell, [optionalBashPathArgument, "-c", scriptCode].filter(arg => arg !== ""), { timeout: spawnTimeout, shell: false }); | ||
} |