admin管理员组文章数量:1410689
I want to run a mand inside of a script tag within my index.html file using node webkit. Is such a thing possible and how would the code look like if I wanted to execute the mand 'pwd' for example?
Thanks in advance
I want to run a mand inside of a script tag within my index.html file using node webkit. Is such a thing possible and how would the code look like if I wanted to execute the mand 'pwd' for example?
Thanks in advance
Share Improve this question asked Jul 30, 2014 at 19:13 user2554585user2554585 3,6797 gold badges21 silver badges23 bronze badges2 Answers
Reset to default 4Does something like this not work?
var sys = require('sys')
var exec = require('child_process').exec;
var child;
// executes `pwd`
child = exec("pwd", function (error, stdout, stderr) {
sys.print('stdout: ' + stdout);
sys.print('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
The documentation for node webkit states:
Complete support for Node.js APIs and all its third party modules.
Which would indicate that you could use the node childprocess api:
http://nodejs/api/child_process.html
本文标签: javascriptExecute Command from Node WebkitStack Overflow
版权声明:本文标题:javascript - Execute Command from Node Webkit - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745019910a2638067.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论