> On Jul 24, 2016, at 12:53 AM, Ruchit Kadakia <[email protected]> wrote:
> 
> I am trying to run this command from node.js file
> 
> var sys = require('sys')
> 
> var exec = require('child_process').exec;
> 
> 
> 
> var child1 = exec("cd: /usr/local ", function (error, stdout, stderr) {
> 
>   sys.print('stdout: ' + stdout);
> 
>   sys.print('stderr: ' + stderr);
> 
>   if (error !== null) {
> 
>     console.log('exec error: ' + error);
> 
>   }
> 
> 
> });
> 
> 
> 
> It is giving me error command not found whereas all  ls, pwd commands work 
> well

Well, there shouldn't be a colon there. The command name is "cd", not "cd:". 
But just running "cd" isn't going to accomplish much, since exec runs in a 
separate shell. That separate shell will start, change to the directory, then 
exit, accomplishing nothing. What are you actually trying to do?


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/A85A93A8-9CBB-466C-B838-734D4B3C1694%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to