Boost logo

Boost-Commit :

From: troy_at_[hidden]
Date: 2008-06-14 21:53:21


Author: troy
Date: 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
New Revision: 46403
URL: http://svn.boost.org/trac/boost/changeset/46403

Log:
Windows support: kill subprocesses differently on unix/windows in case of timeout. Use 'platform' module, not 'os.uname'
Added:
   branches/CMake/release/tools/build/CMake/unix_kill.py.in (contents, props changed)
   branches/CMake/release/tools/build/CMake/windows_kill.py.in (contents, props changed)
Text files modified:
   branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake | 13 +++++++++++++
   branches/CMake/release/tools/build/CMake/boost_build_slave.py.in | 4 ++--
   branches/CMake/release/tools/build/CMake/marshal.py.in | 4 ++--
   3 files changed, 17 insertions(+), 4 deletions(-)

Modified: branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostBuildSlave.cmake 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
@@ -41,6 +41,19 @@
     )
 endforeach()
 
+if(WIN32)
+ configure_file(tools/build/CMake/windows_kill.py.in
+ ${BOOST_BUILD_SLAVE_PYTHONPATH}/kill_subprocess.py
+ COPYONLY
+ )
+else(WIN32)
+ configure_file(tools/build/CMake/unix_kill.py.in
+ ${BOOST_BUILD_SLAVE_PYTHONPATH}/kill_subprocess.py
+ COPYONLY
+ )
+endif(WIN32)
+
+
 #
 # the test driver is either marshal or passthru depending on whether
 # you're in build slave mode or not. The compilation/link rules

Modified: branches/CMake/release/tools/build/CMake/boost_build_slave.py.in
==============================================================================
--- branches/CMake/release/tools/build/CMake/boost_build_slave.py.in (original)
+++ branches/CMake/release/tools/build/CMake/boost_build_slave.py.in 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
@@ -11,14 +11,14 @@
 # Utilities, variables, imports for build slave python
 #
 
-import os, os.path, marshal, xmlrpclib, pysvn, socket
+import os, os.path, marshal, xmlrpclib, pysvn, socket, platform
 from pprint import pprint
 
 repo_path = "@CMAKE_SOURCE_DIR@"
 client = pysvn.Client()
 svn_entry = client.info(repo_path)
 fqdn = socket.getfqdn()
-uname = os.uname()
+uname = platform.uname()
 toolset = "@BOOST_TOOLSET@"
 
 timeout_seconds = @BOOST_BUILD_SLAVE_TIMEOUT@

Modified: branches/CMake/release/tools/build/CMake/marshal.py.in
==============================================================================
--- branches/CMake/release/tools/build/CMake/marshal.py.in (original)
+++ branches/CMake/release/tools/build/CMake/marshal.py.in 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
@@ -17,6 +17,7 @@
 
 import datetime, time, signal
 from subprocess import Popen, PIPE
+from kill_subprocess import kill_subprocess
 
 log = os.path.join(sys.argv[1], "Log.marshal")
 op = sys.argv[2]
@@ -40,8 +41,7 @@
         time.sleep(1)
         now = datetime.datetime.now()
         if (now - starttime).seconds > timeout_seconds:
- os.kill(subproc.pid, signal.SIGKILL)
- os.waitpid(-1, os.WNOHANG)
+ kill_subprocess(subproc.pid)
             e = OSError()
             e.errno = 666
             e.message = e.strerror = "TIMEOUT AFTER %d SECONDS" % timeout_seconds

Added: branches/CMake/release/tools/build/CMake/unix_kill.py.in
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/unix_kill.py.in 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
@@ -0,0 +1,6 @@
+import os
+def kill_subprocess(pid):
+ os.kill(subproc.pid, signal.SIGKILL)
+ os.waitpid(-1, os.WNOHANG)
+
+

Added: branches/CMake/release/tools/build/CMake/windows_kill.py.in
==============================================================================
--- (empty file)
+++ branches/CMake/release/tools/build/CMake/windows_kill.py.in 2008-06-14 21:53:20 EDT (Sat, 14 Jun 2008)
@@ -0,0 +1,5 @@
+import os
+def kill_subprocess(pid):
+ cmd = 'TASKKILL /PID ' + str(pid) + ' /T /F'
+ print "Timeout, killing subprocess:\n" + cmd
+ os.popen(cmd)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk