Node-Webkit Child Process Exec

I want to execute a homebrew command for example

brew list

I followed the documentation and executed it like this:

child = exec('brew', function (error, stdout, stderr) {
 console.log(stdout);
 console.log(stderr);
});

I am getting a command not found error, and realized that if I do /usr/local/bin/brew as the command it works. However simply using ‘brew’ should work as well since I can run ‘brew’ from the command line just as such.

Why is this the case and what does it take to make ‘brew’ run as a child process in node? I have a feeling part of the issue because the command on node-webkit seems to execute from bin/sh.

Thanks

how do I make node child_process exec continuously

How to exec continuously? e.g. ls after cd? I tried exec = require(‘child_process’).exec; exec(‘cd ~/’, function(){ exec(‘ls’), function(err, stdout, stderr){ console.log(stdout); // this logs current

making parent process wait till child has called exec

In linux, after calling fork(), my child process is going to call exec soon. Is there a way for the parent process to wait() and not do anything till the child has exec’ed? Thanks.

when will the parent process get exit status of the child, if child calls exec()

Can any one please let me know when will the parent process get exit status of the child, if child calls exec()? Is it at the time when child calls exec or when the child process finishes its executio

Using redirection operator in child_process.exec

I’m trying to redirect my command output using: var exec = require(‘child_process’).exec; var proc = exec(‘command > out’); I think the problem is related to the output redirection. I know I can u

child_process exec returning a mysterious error

I have the following code (copied from the node docs apart from the command itself) : var util = require(‘util’), exec = require(‘child_process’).exec, child, command = ‘libreoffice –headless -conver

perl fork() exec() , child process gone wild

I am using Linux and .sh is in tcsh. I have made a very basic fork and exec, but I need help in implementing safeties to it. Basically my perl script calls a .sh script in a child process. But when

Why would calling a child_process command work with exec but not spawn?

Why would this work: var exec = require(child_process).exec; var command = exec(grunt); But this throws an error: var spawn = require(child_process).spawn; var command = spawn(grunt); The er

exec child_process in a node js module

I’m createing a node module that I want to have a function called cpuUtilization that calls a python script and the stdout is returned. var sys = require(‘sys’) var exec = require(‘child_process’).exe

Node.JS Child Process exec strange behaviour

when I execute a command in terminal it lasts ~5s, but when I use require(‘child_process’).exec with 1m timeout it returns [Error: Command failed: ] killed: true, code: null, signal: ‘SIGTERM’ in

TCL: exec egrep “child process exited abnormally”

I have a problem with egrep command. When I execute my command in tcsh it is working perfect but when I execute it from tcl script or in tclsh, I got: child process exited abnormally My tcl code: exe

Answers

It may depend on how you’re starting node-webkit and how you’re setting your PATH. When I start from the command line, it inherits the environment variables from my command-line environment, including PATH. If I start by double clicking in a gui, it inherits from the system (presumably /etc/paths), and any additions I make in my .bashrc/.bash_profile have no effect.

Also, I’m no security expert, but my understanding of best practices would include using an absolute path to the executable you’re running, so it’s harder to spoof by setting an environment variable. By that measure, you’re better off using the full path to brew anyway.