1

I'm struggling with running a bash-script within main.html.

 const exec = require("child_process").exec;

 // Execute bash script
 exec("/c/workspace/_edu_zone/Proxy_Manager/filemover.sh", shellCallback);

 // Callback
 function shellCallback(error, stdout, stderr) {
    console.log(error, stdout)
 }

I'm always getting the error: no such file or directory. What am i doing wrong? Any help is highly appreciated.

1
  • change /c/workspace/_edu_zone/Proxy_Manager/filemover.sh to c:/workspace/_edu_zone/Proxy_Manager/filemover.sh Commented Apr 19, 2018 at 15:35

1 Answer 1

1

change

/c/workspace/_edu_zone/Proxy_Manager/filemover.sh

to

c:/workspace/_edu_zone/Proxy_Manager/filemover.sh

or

your could try using node-powershell to execute the command directly

const shell = require('node-powershell')

let ps = new shell({
    executionPolicy: 'Bypass',
    noProfile: true
});

function lunchnode() {
    process.stdout.write('logging');
    ps.addCommand('node run.js')
    ps.invoke()
   .then(function (output) {
       process.stdout.write(output)
   }).catch(function (err) {
       process.stdout.write(err)
       ps.dispose()
   })   
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.