Join GitHub today
cmd: support dash as stdin alias #13012
Affected core subsystem(s)
Dash as stdin alias is a usual convention between unix programs https://unix.stackexchange.com/a/16364 and I believe it should be available on nodejs also.
Here I've made a change that make node ignore dash as an option so it will effectively be treated like /dev/stdin
Simply, with my change this will be made possible with node:
The reason I like to have this is because of my one-file webserver http://pad.js.org which in order to be able to pass extra option to its one-linear execution command on the fly (without having to download or install the script first, which it supports that also through npm and docker). BTW, have a look at that project also, I guess you will find it interesting, specially the way its source is distributed and several features it offers :)
Interestingly, I saw during my tests if I pass "/std/stdin" instead "-" on the above command, even without my change, it will be ran on macOS just fine but for some reasons it seems it doesn't work on Linux equally which perhaps should be filed as a bug separately (Edited: proposed another patch for that). However with this change, "-" will provide a cross platform solution for achieving this goal.
For my specific case, this patch will make this functionality possible:
which as mentioned before if you have access to macOS, this is already possible with the following command, but not on Linux and obviously ever Windows:
I've retriggered linux-fips: https://ci.nodejs.org/job/node-test-commit-linux-fips/8382/
I'm assuming this is your first contribution so I've put down a little explanation. If it's not ignore the rest
Our "landing" policy is to wait 2 days (3-4 if it's weekend) so that stakeholders can chime in. Since I've marked this as
Good luck, and thank you very much for the contribution
referenced this pull request
May 14, 2017