Execute Shell Commands from Application



I am planning to develop a desktop application using electron. From my application, I need to execute couple of terminal commands. I know that from Javascript we can’t execute command line arguments as this leads to security hole.
Is there any way to execute shell commands from electron? Please advise.

Thanks in advance


Refer to node’s ChildProcess documentation for an example of a possibility. Also keep in mind that the whole Node library is available in Electron.


If running Unix shell commands is your goal, have a look at ShellJS. It allows you to use Unix utilities, like mkdir and sed, in Javascript, with the familiar syntax from Bash. Perhaps exec is especially interesting if you want to run arbitrary commands.


Thank You!
I have one more question.
Is it possible to call user defined DLL functions from electron in case of Windows?
Also, is it possible to call user defined shared library functions from electron in case of MAC?


You’ll have to create a c++ add-on, as described here