-1

I would like to run commands on my home server via a web app. Is there a way to do this?

I have no interest in returning the output, I just want to execute commands like irsend when a button is pressed on the page.

Timmo
  • 2,266
  • 4
  • 34
  • 54
  • Like this? http://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js – BrTkCa Sep 19 '16 at 20:21
  • Yes, however it is giving me an error. My main.js which I ran through browserify: const exec = require('child_process').exec; exec('ls', function (error, stdout, stderr) { }); This gives an error of exec is not a function – Timmo Sep 19 '16 at 20:43
  • Edit you question with code as you trying and the follow error. – BrTkCa Sep 19 '16 at 20:48

1 Answers1

1

You can't execute commands directly from the browser, that is why child_process.exec() does not work when browserify your code.

You will need to send an HTTP request of some kind to the server and have it run the command there instead (using child_process.exec()/child_process.spawn()).

mscdex
  • 104,356
  • 15
  • 192
  • 153