Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support node scripts in BROWSER #1590
Modify OpenBrowser.js to run node scripts specified with the
Some observations I'd like to discuss:
How to test this:
create any 'script.js' file. You can use this one that writes a file to the
const fs = require('fs') fs.writeFileSync('message.txt', 'script says hello!');
Now in the same directory execute:
The file should be created in that directory and no browser should be opened.
And of course, the other use cases of
Any feedback is appreciated.
Actually I'm starting to think that just like with the browser, the url should be passed as a parameter to the script. One of the use cases for this is #1450. It's kinda unreliable to add query strings if you don't know the url. Sure it's localhost, but what about the port? it could have been specified by
If the script is invoked with
This might make things a bit weirder but I also think that it might be useful to let the script read all the arguments passed to
It certainly looks cool, although hardcoding into the script might be good enough since you probably only do
I'd like to know what you guys think, specially the ones that actually want to use this feature.
btw, I changed spawn to cross-spawn as suggested.
added a commit
this pull request
Feb 24, 2017
I fully agree.
Yes, I think it should work by passing a URL as the first argument, and then passing any additional arguments verbatim.
Since browsers are launched with the url as last argument, I decided to follow that convention. the