Closed alessioalex closed 9 years ago
I'm not sure of all the implications, but in my case using the native Node child_process.kill()
worked:
//...
setTimeout(function() {
instance.process.kill();
}, 10000);
//...
@gregpabian do you want me to make a pull request on this or is there something I missed?
OS: Windows 7 Node: 0.10.22 NPM: 1.3.14
I also think this function should work on other OSes. I can test on OSX on my end when I get back home. Let me know.
On Windows 7 when I call instance.stop() all my other instances are killed.
This can be easily fixed for most of the browsers, but there's still a problematic case, see below.
I'm not sure of all the implications, but in my case using the native Node child_process.kill() worked:
Let me first explain why we're not using process.kill()
right now.
Most of the browsers available on Windows can be launched using their executable - e.g. chrome.exe, firefox.exe or iexplore.exe, but then there is Opera... To launch the Opera browser properly the Launcher.exe file is used. That file start the actual instance of the browser (Opera.exe) and then stops immediately. It means that:
exit
event (we use the instance's stop
event to fake it, but it only works while calling instance.stop manually).taskkill
command with /F /IM
options and pass Opera.exe as the image name. It works, more-less, but definitely has to be changed due to the issue you reported.So I think we may use process.kill
for most of the browsers, but still have to work out a better solution for Opera-.
I also experience another strange thing, I see logs telling me more browsers that I've launched are stopped
I still have to investigate it, but thanks.
do you want me to make a pull request on this or is there something I missed?
I'll take care of it once I find a better approach for Opera-like cases.
Anyway, thanks again for reporting this.
Hey,
On Windows 7 when I call
instance.stop()
all my other instances are killed.I also experience another strange thing, I see logs telling me more browsers that I've launched are stopped:
My code looks like this: