mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 00:09:30 +01:00
Merge pull request #305756 from microsoft/revert-291825-child-process
Revert "Replace child_process.exec with execFile to prevent potential command injection"
This commit is contained in:
@@ -18,9 +18,9 @@ function exists(file: string): Promise<boolean> {
|
||||
});
|
||||
}
|
||||
|
||||
function exec(command: string, args: string[], options: cp.ExecFileOptions): Promise<{ stdout: string; stderr: string }> {
|
||||
function exec(command: string, options: cp.ExecOptions): Promise<{ stdout: string; stderr: string }> {
|
||||
return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => {
|
||||
cp.execFile(command, args, options, (error, stdout, stderr) => {
|
||||
cp.exec(command, options, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject({ error, stdout, stderr });
|
||||
}
|
||||
@@ -143,9 +143,9 @@ class FolderDetector {
|
||||
return emptyTasks;
|
||||
}
|
||||
|
||||
const gruntCommand = await this._gruntCommand;
|
||||
const commandLine = `${await this._gruntCommand} --help --no-color`;
|
||||
try {
|
||||
const { stdout, stderr } = await exec(gruntCommand, ['--help', '--no-color'], { cwd: rootPath });
|
||||
const { stdout, stderr } = await exec(commandLine, { cwd: rootPath });
|
||||
if (stderr) {
|
||||
getOutputChannel().appendLine(stderr);
|
||||
showError();
|
||||
|
||||
Reference in New Issue
Block a user