Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Remove use of the deprecated `shell: true` option in process spawn operations.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
7 changes: 2 additions & 5 deletions libraries/rush-lib/src/scripts/install-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ function _resolvePackageVersion(

const spawnSyncOptions: childProcess.SpawnSyncOptions = {
cwd: rushTempFolder,
stdio: [],
shell: _isWindows()
stdio: []
};
const platformNpmPath: string = _getPlatformPath(npmPath);
const npmVersionSpawnResult: childProcess.SpawnSyncReturns<Buffer | string> = childProcess.spawnSync(
Expand Down Expand Up @@ -365,8 +364,7 @@ function _installPackage(
const result: childProcess.SpawnSyncReturns<Buffer> = childProcess.spawnSync(platformNpmPath, [command], {
stdio: 'inherit',
cwd: packageInstallFolder,
env: process.env,
shell: _isWindows()
env: process.env
});

if (result.status !== 0) {
Expand Down Expand Up @@ -466,7 +464,6 @@ export function installAndRun(
result = childProcess.spawnSync(platformBinPath, packageBinArgs, {
stdio: 'inherit',
windowsVerbatimArguments: false,
shell: _isWindows(),
cwd: process.cwd(),
env: process.env
});
Expand Down
4 changes: 0 additions & 4 deletions libraries/rush-lib/src/utilities/Utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,9 @@ export class Utilities {
): TCommandResult {
let shellCommand: string = process.env.comspec || 'cmd';
let commandFlags: string = '/d /s /c';
let useShell: boolean = true;
if (process.platform !== 'win32') {
shellCommand = 'sh';
commandFlags = '-c';
useShell = false;
}

const environment: IEnvironment = Utilities._createEnvironmentForRushCommand({
Expand All @@ -670,7 +668,6 @@ export class Utilities {

const spawnOptions: child_process.SpawnOptions = {
cwd: options.workingDirectory,
shell: useShell,
env: environment,
stdio
};
Expand Down Expand Up @@ -810,7 +807,6 @@ export class Utilities {
}: IExecuteCommandInternalOptions): Promise<IWaitForExitResult<string> | IWaitForExitResultWithoutOutput> {
const options: child_process.SpawnSyncOptions = {
cwd: workingDirectory,
shell: true,
stdio: stdio,
env: keepEnvironment
? environment
Expand Down
Loading