OLD | NEW |
---|---|
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 start_cmd += ['-c', 'Alias %s "%s"' % (alias, path), | 119 start_cmd += ['-c', 'Alias %s "%s"' % (alias, path), |
120 # Disable CGI handler for additional dirs. | 120 # Disable CGI handler for additional dirs. |
121 '-c', '<Location %s>' % alias, | 121 '-c', '<Location %s>' % alias, |
122 '-c', 'RemoveHandler .cgi .pl', | 122 '-c', 'RemoveHandler .cgi .pl', |
123 '-c', '</Location>'] | 123 '-c', '</Location>'] |
124 | 124 |
125 self._start_cmd = start_cmd | 125 self._start_cmd = start_cmd |
126 | 126 |
127 def _spawn_process(self): | 127 def _spawn_process(self): |
128 _log.debug('Starting %s server, cmd="%s"' % (self._name, str(self._start _cmd))) | 128 _log.debug('Starting %s server, cmd="%s"' % (self._name, str(self._start _cmd))) |
129 self._process = self._executive.popen(self._start_cmd, stderr=self._exec utive.PIPE) | 129 self._process = self._executive.popen(self._start_cmd) |
130 if self._process.returncode is not None: | 130 retval = self._process.returncode |
131 retval = self._process.returncode | 131 if retval: |
132 err = self._process.stderr.read() | 132 raise server_base.ServerError('Failed to start %s: %s' % (self._name , retval)) |
Dirk Pranke
2014/11/11 16:31:53
This change worries me. I fairly strongly recall t
Kunihiko Sakamoto
2014/11/12 01:02:39
Got it. Let's try this for now.
| |
133 if retval or len(err): | |
134 raise server_base.ServerError('Failed to start %s: %s' % (self._ name, err)) | |
135 | 133 |
136 # For some reason apache isn't guaranteed to have created the pid file b efore | 134 # For some reason apache isn't guaranteed to have created the pid file b efore |
137 # the process exits, so we wait a little while longer. | 135 # the process exits, so we wait a little while longer. |
138 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f ile)): | 136 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f ile)): |
139 self._log_errors_from_subprocess() | 137 self._log_errors_from_subprocess() |
140 raise server_base.ServerError('Failed to start %s: no pid file found ' % self._name) | 138 raise server_base.ServerError('Failed to start %s: no pid file found ' % self._name) |
141 | 139 |
142 return int(self._filesystem.read_text_file(self._pid_file)) | 140 return int(self._filesystem.read_text_file(self._pid_file)) |
143 | 141 |
144 def stop(self): | 142 def stop(self): |
(...skipping 18 matching lines...) Expand all Loading... | |
163 retval = proc.returncode | 161 retval = proc.returncode |
164 err = proc.stderr.read() | 162 err = proc.stderr.read() |
165 if retval or len(err): | 163 if retval or len(err): |
166 raise server_base.ServerError('Failed to stop %s: %s' % (self._name, err)) | 164 raise server_base.ServerError('Failed to stop %s: %s' % (self._name, err)) |
167 | 165 |
168 # For some reason apache isn't guaranteed to have actually stopped after | 166 # For some reason apache isn't guaranteed to have actually stopped after |
169 # the stop command returns, so we wait a little while longer for the | 167 # the stop command returns, so we wait a little while longer for the |
170 # pid file to be removed. | 168 # pid file to be removed. |
171 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p id_file)): | 169 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p id_file)): |
172 raise server_base.ServerError('Failed to stop %s: pid file still exi sts' % self._name) | 170 raise server_base.ServerError('Failed to stop %s: pid file still exi sts' % self._name) |
OLD | NEW |