Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

lifecycle: add /d and /s to cmd.exe #9245

Closed
wants to merge 1 commit into from
Closed

Conversation

saper
Copy link
Contributor

@saper saper commented Aug 11, 2015

/d disables cmd.exe AutoRuns feature, where registry entry points to the script that will be executed when cmd.exe starts. Surprisingly a lot of users have CD \ or similar command there which causes lifecycle scripts to fail, since relative path to the script no longer works (and package.json has no way to deduce absolute path)

/s enables handling of quotes, so that you can have "C:\Program Files\Node\node.exe" quoted in your script. Node's child_process.exec() is doing the same. We prevent additional quoting by libuv already by setting uv_spawn() flag UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS.

If those flags are not set there is no way package.json can reliably tell us to run "node" executable with a relative script path:

    "scripts": {
      "install": "node scripts/install.js"
    }

Without /d "node" invocation may end up in a random directory as a result of the AutoRuns command.

Fixes:
#8751
#7333
sass/node-sass#1027
sass/node-sass#1012
sass/node-sass#659
sass/node-sass#603

/d disables cmd.exe AutoRuns feature,
   where registry entry points to the
   script that will be executed when cmd.exe
   starts. Surprisingly a lot of users
   hase "CD \" or similar command there
   which causes lifecycle scripts to fail,
   since relative path to the script no longer
   works (and package.json has no way to deduce
   absolute path)

/s enables handling of quotes, so that you
   can have "C:\Program Files\Node\node.exe" quoted
   in your script. Node's child_process.exec()
   is doing the same. We prevent additional quoting
   by libuv already by setting uv_spawn() flag
   UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS.

If those flags are not set there is no way
package.json can reliably tell us to run "node"
executable with a relative script path:

    "scripts": {
      "install": "node scripts/install.js"
    }

Without /d "node" invocation may end up
in a random directory as a result of
the AutoRuns command.

Fixes:
    npm#8751
    npm#7333
    sass/node-sass#1027
    sass/node-sass#1012
    sass/node-sass#659
    sass/node-sass#603
@othiym23 othiym23 added this to the 2.x-next-next milestone Aug 11, 2015
@othiym23 othiym23 self-assigned this Aug 17, 2015
othiym23 pushed a commit that referenced this pull request Aug 21, 2015
/d disables cmd.exe AutoRuns feature, where registry entry points to the
script that will be executed when cmd.exe starts. Surprisingly a lot of
users hase "CD \" or similar command there which causes lifecycle
scripts to fail, since relative path to the script no longer works (and
package.json has no way to deduce absolute path)

/s enables handling of quotes, so that you can have "C:\Program
Files\Node\node.exe" quoted in your script. Node's child_process.exec()
is doing the same. We prevent additional quoting by libuv already by
setting uv_spawn() flag UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS.

If those flags are not set there is no way package.json can reliably
tell us to run "node" executable with a relative script path:

    "scripts": {
      "install": "node scripts/install.js"
    }

Without /d "node" invocation may end up in a random directory as a
result of the AutoRuns command.

Fixes: #8751
Fixes: #7333

PR-URL: #9245
@othiym23
Copy link
Contributor

Rebased, tested by hand on Windows (because I have yet to figure out how to test these kinds of things automatically), and landed as 204ebbb. Thanks, @saper!

@othiym23 othiym23 closed this Aug 21, 2015
iarna pushed a commit that referenced this pull request Aug 21, 2015
/d disables cmd.exe AutoRuns feature, where registry entry points to the
script that will be executed when cmd.exe starts. Surprisingly a lot of
users hase "CD \" or similar command there which causes lifecycle
scripts to fail, since relative path to the script no longer works (and
package.json has no way to deduce absolute path)

/s enables handling of quotes, so that you can have "C:\Program
Files\Node\node.exe" quoted in your script. Node's child_process.exec()
is doing the same. We prevent additional quoting by libuv already by
setting uv_spawn() flag UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS.

If those flags are not set there is no way package.json can reliably
tell us to run "node" executable with a relative script path:

    "scripts": {
      "install": "node scripts/install.js"
    }

Without /d "node" invocation may end up in a random directory as a
result of the AutoRuns command.

Fixes: #8751
Fixes: #7333

PR-URL: #9245
@saper
Copy link
Contributor Author

saper commented Aug 21, 2015

Thanks. I think traditional unit testing is not well suited for integration issues like this.

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

Successfully merging this pull request may close these issues.

None yet

2 participants