Commit ca07f6e9 ca07f6e9e260a6fb121a17e92cb28acc5b09b482 by Justine Tunney

make python launcher use os.execvp() instead of subprocess.Popen()

This fixes a bug where casperjs' python launcher process won't pass along kill
signals to the phantomjs subprocess. This patch works by using an exec system
call which causes the phantomjs subprocess to completely replace the casperjs
parent process (while maintaining the same pid). This patch also has the added
benefit of saving 10 megs or so of memory.
1 parent 403714de
...@@ -48,11 +48,7 @@ CASPER_COMMAND.extend([os.path.join(CASPER_PATH, 'bin', 'bootstrap.js'), '--casp ...@@ -48,11 +48,7 @@ CASPER_COMMAND.extend([os.path.join(CASPER_PATH, 'bin', 'bootstrap.js'), '--casp
48 CASPER_COMMAND.extend(CASPER_ARGS) 48 CASPER_COMMAND.extend(CASPER_ARGS)
49 49
50 try: 50 try:
51 status = subprocess.call(CASPER_COMMAND) 51 os.execvp(CASPER_COMMAND[0], CASPER_COMMAND)
52 except OSError, err: 52 except OSError, err:
53 status = 1
54 print('Fatal: %s; did you install phantomjs?' % err) 53 print('Fatal: %s; did you install phantomjs?' % err)
55 except KeyboardInterrupt: 54 sys.exit(1)
56 print('\nCasperJS interrupted, exiting.')
57 status = 0
58 sys.exit(status)
......