Skip to content

Commit

Permalink
Use spawn instead of exec to execute command (Fixes #171) (#428)
Browse files Browse the repository at this point in the history
* Use spawn instead of exec to execute command

* Use toString instead of TextDecoder
  • Loading branch information
JeffreyCA authored and formulahendry committed Aug 14, 2019
1 parent 2ba8bc2 commit 7548e15
Show file tree
Hide file tree
Showing 2 changed files with 2,359 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/codeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,21 +474,21 @@ export class CodeManager implements vscode.Disposable {
}
const showExecutionMessage = this._config.get<boolean>("showExecutionMessage");
this._outputChannel.show(this._config.get<boolean>("preserveFocus"));
const exec = require("child_process").exec;
const spawn = require("child_process").spawn;
const command = this.getFinalCommandToRunCodeFile(executor, appendFile);
if (showExecutionMessage) {
this._outputChannel.appendLine("[Running] " + command);
}
this.sendRunEvent(executor, false);
const startTime = new Date();
this._process = exec(command, { cwd: this._cwd });
this._process = spawn(command, [], { cwd: this._cwd, shell: true });

this._process.stdout.on("data", (data) => {
this._outputChannel.append(data);
this._outputChannel.append(data.toString());
});

this._process.stderr.on("data", (data) => {
this._outputChannel.append(data);
this._outputChannel.append(data.toString());
});

this._process.on("close", (code) => {
Expand Down
Loading

0 comments on commit 7548e15

Please sign in to comment.