Running a childProcess as shell script with node.js server

0 votes

I'm running a shell script on my node.js server. Now, one childProcess works perfectly:
childProcess.exec('ls /media/external/', movieCallback); 

But the other process just won't work:
childProcess.exec('~/./ /media/external/' +, function() {}); 

Here's the error I get:
/bin/sh: 1: /root/./ not found 

Also, running the script in terminal, it works just fine. I've double-checked that chmod +x is set.
Any clues on what could be going wrong?
Do tell! Thanks in advance.

Aug 14, 2018 in IoT (Internet of Things) by Bharani
• 4,580 points

1 answer to this question.

0 votes

Here's what I think, you could pass the arguments error, stdout and stderr to the exec function callback. Then, try identifying the problem by spitting them out to the console so that it's easy to spot it out:

exec('~/./ /media/external/' +,
  function (error, stdout, stderr) {
    console.log('stdout: ' + stdout);
    console.log('stderr: ' + stderr);
    if (error !== null) {
      console.log('exec error: ' + error);

Hope this helps! :)

answered Aug 14, 2018 by DataKing99
• 8,210 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Connect to external server through Socket.IO from Node.js

I think the server you're connecting to ...READ MORE

answered Nov 21, 2018 in IoT (Internet of Things) by nirvana
• 3,120 points
0 votes
1 answer

Display time in a Windows Core IoT app with a clock!

It is possible, but you should understand ...READ MORE

answered Jul 9, 2018 in IoT (Internet of Things) by nirvana
• 3,120 points
0 votes
1 answer

Using FIWARE to start Cygnus as a Service in IoT Solution

Cygnus is supposed to create /var/run/cygnus/ when started. You ...READ MORE

answered Aug 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
0 votes
1 answer
0 votes
1 answer

How to send Bitcoins with node.js?

This website will successfully do the bitcoin transaction. You ...READ MORE

answered Jul 20, 2018 in Blockchain by Christine
• 15,810 points
0 votes
1 answer

How to read the ETH value and other token values from an account?

You can do this eth.accounts shows you all known ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 69,030 points
0 votes
1 answer

Building Python Server for Secure communication with Raspberry Pi

There could be several ways to add ...READ MORE

answered Jan 10, 2019 in IoT (Internet of Things) by DataKing99
• 8,210 points
0 votes
1 answer