久久久久久久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í)的歡迎消息)
主站蜘蛛池模板: 久草青青 | 日韩国产欧美一区 | 91爱爱·com| 欧美久久久电影 | 国产精品入口 | 国产香蕉视频在线播放 | 成年无码av片在线 | 久久高清| 国产精品无码久久久久 | 九九热在线视频观看这里只有精品 | 中文字幕在线国产 | 国产h视频 | 免费看啪啪网站 | 狠狠久| 第一区在线观看免费国语入口 | 亚洲一区二区在线播放 | 日韩第一夜 | 国产日韩欧美在线观看 | 午夜视频网站 | 超碰地址 | 一区二区三区在线看 | 日日操日日舔 | 精品乱码一区二区三四区视频 | 国产激情偷乱视频一区二区三区 | 91就要激情| 久久亚洲一区二区三区四区 | 免费成人高清在线视频 | 国产精品99久久久久久动医院 | 国产成人免费视频网站高清观看视频 | 中国黄色在线视频 | 2021天天干夜夜爽 | 九九九久久国产免费 | 精品久久久久久 | 天天综合天天 | 超碰在线人 | 欧美亚州 | 亚洲精品九九 | 免费视频一区二区 | 黄网站在线观看 | 欧美一级片在线观看 | 男女羞羞视频网站 |