如何使用Node.js以编程方式启动和终止Web浏览器?
像这样的伪代码:
var spawn = require('child_process').spawn;
// This opens a browser and returns control to terminal, but optimally
// the process should run in the foreground and exit on ctrl-c.
spawn('open', ['http://www.stackoverflow.com']);
process.on('SIGINT', function() {
// Kill the opened browser here
});
答案 0 :(得分:-1)