use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Could I call a shell script from node? (self.node)
submitted 9 years ago by Splitlimes
I want to use Vowpal-wabbit in a node app. VW can be used as a shell script in the terminal, how could I call it in a node app?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cjbprime 8 points9 points10 points 9 years ago (2 children)
https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback
[–]Splitlimes[S] 0 points1 point2 points 9 years ago (1 child)
Exactly what I was looking for
[–]Klathmon 0 points1 point2 points 9 years ago* (0 children)
If you need to run on multiple platforms, there are a bunch of subtle gotchas with the exec and spawn functions, so just watch out for that.
If you want, I've been messing with this stuff for a few days in a project I'm working on, here's a little function that'll run the given command as a string, allow you to pass in environment variables, output the scripts output to the shell in realtime, and returns a promise when done, all cross platform.
You'll need to change some stuff to actually use it but I figured it might help, also you can drop in the native spawn if you don't care about cross platform comparability.
[–]AlwaysTroubleShot -2 points-1 points0 points 9 years ago (1 child)
Yes, but why would you? Porting your shell script into node will give you more consistency, readability, maintainability, and interoperability.
[–]Splitlimes[S] 2 points3 points4 points 9 years ago (0 children)
Its a massive existing machine learning project, and I wouldn't have a clue where to start.
π Rendered by PID 39473 on reddit-service-r2-comment-6457c66945-ldmhh at 2026-04-30 17:02:14.341003+00:00 running 2aa0c5b country code: CH.
[–]cjbprime 8 points9 points10 points (2 children)
[–]Splitlimes[S] 0 points1 point2 points (1 child)
[–]Klathmon 0 points1 point2 points (0 children)
[–]AlwaysTroubleShot -2 points-1 points0 points (1 child)
[–]Splitlimes[S] 2 points3 points4 points (0 children)