diff options
-rw-r--r-- | webkit/tools/layout_tests/layout_package/websocket_server.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/webkit/tools/layout_tests/layout_package/websocket_server.py b/webkit/tools/layout_tests/layout_package/websocket_server.py index 5e5e4f5..5687259 100644 --- a/webkit/tools/layout_tests/layout_package/websocket_server.py +++ b/webkit/tools/layout_tests/layout_package/websocket_server.py @@ -86,8 +86,11 @@ class PyWebSocket(http_server.Lighttpd): log_prefix = _WSS_LOG_PREFIX else: log_prefix = _WS_LOG_PREFIX - log_file_name = log_prefix + time_str + '.txt' - error_log = os.path.join(self._output_dir, log_file_name) + log_file_name = log_prefix + time_str + error_log = os.path.join(self._output_dir, log_file_name + "-err.txt") + self._wserr = open(error_log, "w") + output_log = os.path.join(self._output_dir, log_file_name + "-out.txt") + self._wsout = open(output_log, "w") # Remove old log files. We only need to keep the last ones. RemoveLogFiles(self._output_dir, log_prefix) @@ -122,7 +125,8 @@ class PyWebSocket(http_server.Lighttpd): env.get('PYTHONPATH', '')) logging.debug('Starting %s server.' % self._server_name) - self._process = subprocess.Popen(start_cmd, env=env) + self._process = subprocess.Popen(start_cmd, stdout=self._wsout, + stderr=self._wserr, env=env) # Wait a bit before checking the liveness of the server. time.sleep(0.5) @@ -152,6 +156,12 @@ class PyWebSocket(http_server.Lighttpd): # Wait a bit to make sure the ports are free'd up time.sleep(2) + if self._wserr: + self._wserr.close() + self._wserr = None + if self._wsout: + self._wsout.close() + self._wsout = None if '__main__' == __name__: |