Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

child_process.exec cmd.exe registry autorun settings can interfere with command execution #25458

Closed
fodonnel opened this issue May 29, 2015 · 1 comment

Comments

@fodonnel
Copy link

  • node -v: v0.12.40
  • Windows 8.1 64 bit
  • Corporate Env

My Reg key HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun is set too
cd /d H:\ (Coperate env with group policy so I can't change or remove it).

This has the effect of overriding the cwd parameter. So if I run the following

var exec = require('child_process').exec;
exec('dir', function(error, stdout, stderr) {
    console.log('stdout: ' + stdout);
});

exec('dir', { cwd: 'C:/windows' }, function(error, stdout, stderr) {
    console.log('stdout: ' + stdout);
});

I will print out the contents of h:\ twice, instead of c:\windows

If child_process.exec added the /D flag to cmd it would avoid side effects caused by autorun reg settings. So

C:\windows\system32\cmd.exe /D /s /c "dir"

instead of

C:\windows\system32\cmd.exe /s /c "dir"

I originally though this was a jspm issue jspm/registry-endpoint#9 the comments on that thread have more details.

@cjihrig
Copy link

cjihrig commented Jun 2, 2015

@piscisaureus any thoughts here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants