How to call Shell script or python script in from a Atom electron app

后端 未结 3 1249
孤城傲影
孤城傲影 2020-12-14 19:36

I\'m trying to use the Atom electron to write a Desktop App for both Mac and Windows.

What I need here is :

A button.

And when the user click the but

3条回答
  •  清歌不尽
    2020-12-14 19:58

    Try node-powershell npm. You can directly execute shell script commands and display result.

    var shell = require('node-powershell')
    var ps = new shell()
    ps.addCommand('ping -c 4 0.0.0.0')
    ps.invoke()
    .then(function (output) {
        console.log(output)
    })
    .catch(function (err) {
        console.log(err)
        ps.dispose()
    })
    

    See: https://www.npmjs.com/package/node-powershell

提交回复
热议问题