fix(exec): now actually supports shell option#348
Merged
Conversation
Closed
src/exec.js
Outdated
| var execCommand = '"'+process.execPath+'" '+scriptFile; | ||
| var script; | ||
|
|
||
| var optArray = []; |
Contributor
There was a problem hiding this comment.
I feel like this should just be an object that we JSON.stringify.
Member
Author
There was a problem hiding this comment.
That would probably be better. I'll look into that.
e4ba0c0 to
e853caa
Compare
Member
Author
|
@ariporad This should be good now |
e853caa to
358e3ff
Compare
test/exec.js
Outdated
| // check process.env works | ||
| assert.ok(!shell.env.FOO); | ||
| shell.env.FOO = 'Hello world'; | ||
| result = shell.exec('echo $FOO'); |
Contributor
There was a problem hiding this comment.
cmd.exe doesn't support variables prefixed with a $, what you want here is %FOO%.
Contributor
|
LGTM, except for AppVeyor, which is failing. |
358e3ff to
b63dde5
Compare
Member
Author
|
@ariporad it should be working now |
nfischer
added a commit
that referenced
this pull request
Feb 14, 2016
fix(exec): now actually supports shell option
| var script; | ||
|
|
||
| opts.cwd = path.resolve(opts.cwd); | ||
| var optString = JSON.stringify(opts); |
Contributor
There was a problem hiding this comment.
This isn't safe against Unicode newlines (namely, U+2028 and U+2029): http://stackoverflow.com/a/9168133/1937836
Something like https://www.npmjs.com/package/js-stringify should fix this issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Looks like #335 doesn't work perfectly with all options. This is because
execSyncdoes 2 calls toexec(), and some options need to be passed to both calls.This should clean things up a bit, and fix the issue for the
shelloption, which would actually fix #138 and #208.