久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何從 Atom 電子應(yīng)用程序中調(diào)用 Shell 腳本或 py

How to call Shell script or python script in from a Atom electron app(如何從 Atom 電子應(yīng)用程序中調(diào)用 Shell 腳本或 python 腳本)
本文介紹了如何從 Atom 電子應(yīng)用程序中調(diào)用 Shell 腳本或 python 腳本的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試使用 Atom 電子為 Mac 和 Windows 編寫桌面應(yīng)用程序.

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

我需要的是:

一個(gè)按鈕.

當(dāng)用戶單擊按鈕時(shí),它會(huì)運(yùn)行以下 shell(或 python 腳本):

And when the user click the button it runs the following shell (or python script):

ping x.x.x.x

結(jié)果會(huì)顯示在一個(gè)TextArea中.

And the result will be displayed in a TextArea.

我嘗試使用 [shelljs] 和 [yargs],但它似乎不適用于 Atom electron.

I tried to use [shelljs] and [yargs] but it seems like it is not workable with Atom electron.

我想要的只是使用 JAVASCRIPT 編寫桌面應(yīng)用程序(當(dāng)然是 GUI),它調(diào)用一些腳本(shell && python)來做一些自動(dòng)化工作.

All I want is to use JAVASCRIPT to write Desktop App (with GUI of course) that calls some script (shell && python) to do some automation work.

任何建議將不勝感激,謝謝:)

Any suggestion will be appreciated, thanks :)

推薦答案

可以直接用Node做,可以使用child_process模塊.請(qǐng)注意這是異步的.

It can be done directly with Node, you can use the child_process module. Please notice this is asynchronous.

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

function execute(command, callback) {
    exec(command, (error, stdout, stderr) => { 
        callback(stdout); 
    });
};

// call the function
execute('ping -c 4 0.0.0.0', (output) => {
    console.log(output);
});

我鼓勵(lì)你也看看 npm,有大量的模塊可以幫助你做你想做的事想要,無需調(diào)用 python 腳本.

I encourage you to also have a look at npm, there are tons of modules that could help you to do what you want, without calling a python script.

這篇關(guān)于如何從 Atom 電子應(yīng)用程序中調(diào)用 Shell 腳本或 python 腳本的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 国产精品免费福利 | 国产毛片毛片 | 国产极品车模吞精高潮呻吟 | 国产亚洲一区二区精品 | 欧美日韩视频在线第一区 | 97国产精品视频人人做人人爱 | 国产一二三区免费视频 | 91视频久久| 日韩三级一区 | 亚洲欧美中文日韩在线v日本 | 欧美在线观看一区 | 精品国产一区二区三区性色av | 日日夜夜操天天干 | 99视频免费在线 | 久久久91精品国产一区二区三区 | 久久久xx | 中文字幕电影在线观看 | 亚洲欧美国产毛片在线 | 日韩欧美中文在线 | 精品一区二区三区在线视频 | 久久亚洲一区二区 | 99热精品在线观看 | 国产真实精品久久二三区 | 超碰日本 | www.亚洲一区二区三区 | av电影一区 | 狠狠干美女| 亚洲午夜av久久乱码 | 久久综合久| 免费视频一区 | 国产精品久久久久久久岛一牛影视 | 久久精品国产一区二区三区不卡 | 涩色视频在线观看 | 99久久精品视频免费 | 九色 在线| 在线欧美视频 | 精品www| 亚洲精品一二三 | 91久久| 国产色片在线 | av中文字幕在线观看 |