javascript - Programmatically both start and kill a web browser using Node.js -
how can programmatically both start , kill web browser using node.js?
pseudo-ish code so:
var spawn = require('child_process').spawn; // opens browser , returns control terminal, optimally // process should run in foreground , exit on ctrl-c. spawn('open', ['http://www.stackoverflow.com']); process.on('sigint', function() { // kill opened browser here });
you can use "spawn"
https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
also, reference: https://stackoverflow.com/a/16099450/4130451
to kill: https://nodejs.org/api/child_process.html#child_process_child_kill_signal
Comments
Post a Comment