简体   繁体   中英

How to call a shell script from JavaScript?

We were working on a project and wanted to call a shell script from JavaScript. We tried to look for help online but were unable to find any good example for the same. Can someone point is in the right direction ? We tried child_process.exec , but we were unable to get anything out of it.

No. It would be such a gigantic security hole that any browser developer who allowed this would be [family-friendly censorship banner].

The right answer to this is Why do you want to do that?

As pointed out by l0b0, this isn't possible directly. You would need to set up some kind of web service on the server that the JavaScript can call. This service would then in turn call the shell script. But be careful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM