Re: subprocess.Popen(): terminate() exception
Pekka Klärck <[email protected]>
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <CACXFLVdCx2V0LnVP_4+y_0H+ju-0v_Uzv-go-rX0gUvd=_zgww@mail.gmail.com> |
2014-05-12 0:57 GMT+03:00 Michael Büsch <[email protected]>: > > I'm using latest jython hg sources (2.7). > My code uses subprocess.Popen() and eventually calls terminate() on the object. > This fails with the following exception: > >> Traceback (most recent call last): >> File "/home/mb/develop/git/awlsim/./tests/../awlsimcli", line 424, in <module> >> sys.exit(main()) >> File "/home/mb/develop/git/awlsim/./tests/../awlsimcli", line 420, in main >> return runWithServerBackend(inputFile) >> File "/home/mb/develop/git/awlsim/./tests/../awlsimcli", line 274, in runWithServerBackend >> client.shutdown() >> File "/home/mb/develop/git/awlsim/awlsim/coreserver/client.py", line 115, in shutdown >> self.serverProcess.terminate() >> File "/home/mb/develop/hg/jython/dist/Lib/subprocess.py", line 1399, in terminate >> _subprocess.TerminateProcess(self._handle, 1) >> NameError: global name '_subprocess' is not defined > > This looks like a bug in the subprocess module. Neither 'terminate' nor 'kill' nor 'send_signal' are currently supported by Jython, and I would assume that possible Popen configuration parameters added in Python 2.6 or 2.7 aren't supported either. I have understood that supporting everything CPython does is problematic due to JVM limitations (e.g. signals aren't officially supported), but it ought to be possible to implement at least 'kill' by just terminating the started process via the Java API. With CPython 'terminate' sends SIGTERM signal on posix, so if signals aren't supported implementing it that way is not possible. Implementing 'terminate' as an alias for 'kill', like CPython does on Windows, ought to be a good enough workaround. I would love to see at least 'kill' and 'terminate' included into Jython 2.7. Anyone interested to work with me getting them implemented? Cheers, .peke -- Agile Tester/Developer/Consultant :: http://eliga.fi Lead Developer of Robot Framework :: http://robotframework.org ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Jython-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-dev