Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was 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

@fodonnel

Description

@fodonnel
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions