Added ability to run interactively with arguments#5041
Added ability to run interactively with arguments#5041redchair123 wants to merge 1 commit intonodejs:masterfrom redchair123:master
Conversation
src/node.js
Outdated
There was a problem hiding this comment.
Have you run make test? I would expect this to break some of them.
Talking about tests, this PR needs one.
There was a problem hiding this comment.
actually it didn't fail any of the tests from make test, but it did fail linting (though you already pointed that out)
|
@bnoordhuis i updated the PR with code that satisfies the linter (a few space and string-constant issues). Both the original and this version pass all tests. I couldn't find a test in which you controlled the actual arguments passed to the test (looking in the files in the test/ directory). Could you point me to one so that I can craft a relevant test? |
|
@Niggler Make a test that calls node using child_process.spawn() with whatever args, and then write to child.stdin, and verify the stdout and stderr output. |
|
@Niggler Maybe test/simple/test-cli-eval.js? |
There currently is no way to run node interactively and pass arguments without
a file: `node -i foo bar baz` will instruct node to load `foo`.
This commit adds a `--` argument that instructs node to run interactive and not
to load any file in the argv:
$ node -i -- foo bar baz
> process.argv
[ '/the/path/to/node',
'--',
'foo',
'bar',
'baz' ]
The same thing works without the '-i':
$ node -- foo bar baz
> process.argv
[ '/the/path/to/node',
'--',
'foo',
'bar',
'baz' ]
|
@isaacs @bnoordhuis I have added a few tests to verify that |
|
Why not just always run interactively with -i? Do we really need -- at all? On Sunday, March 17, 2013, Niggler wrote:
|
|
@isaacs with your blessing there'll be a patch, but what I'd like to see |
|
@isaacs to explain that point further: (that's not what happens now, but that's what I think |
|
Whitespace errors but nothing that |
|
Discussed in IRC. Bottom line: This is a pretty good start. But I'd rather just go whole-hog here, and do the whole thing in 0.12, rather than have a piecemeal fix where we use Strategy:
@Niggler For this pull req, can you review your approach and see if it still makes sense as a partial solution? |
|
Closing due to lack of activity. Can revisit if someone is interested in updating the PR. Given that this is a feature request, however, it would need to be targeted at either http://github.com/nodejs/io.js or http://github.com/nodejs/node |
There currently is no way to run node interactively and pass arguments without
a file:
node -i foo bar bazwill instruct node to loadfoo.This commit adds a
--argument that instructs node to run interactive and notto load any file in the argv:
The same thing works without the '-i':