Reputation: 3669
I want to run a command 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 command 'pwd' for example?
Thanks in advance
Upvotes: 3
Views: 2292
Reputation: 5303
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.org/api/child_process.html
Upvotes: 4
Reputation: 6433
Does 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);
}
});
Upvotes: 4