Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py

Issue 2188623002: Change logging statements to not use the "%" operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2009, Google Inc. All rights reserved. 1 # Copyright (c) 2009, Google Inc. All rights reserved.
2 # Copyright (c) 2009 Apple Inc. All rights reserved. 2 # Copyright (c) 2009 Apple Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 # to work in cygwin, however it occasionally raises EAGAIN. 141 # to work in cygwin, however it occasionally raises EAGAIN.
142 retries_left = 10 if sys.platform == "cygwin" else 1 142 retries_left = 10 if sys.platform == "cygwin" else 1
143 while retries_left > 0: 143 while retries_left > 0:
144 try: 144 try:
145 retries_left -= 1 145 retries_left -= 1
146 os.kill(pid, signal.SIGKILL) 146 os.kill(pid, signal.SIGKILL)
147 _ = os.waitpid(pid, os.WNOHANG) 147 _ = os.waitpid(pid, os.WNOHANG)
148 except OSError as e: 148 except OSError as e:
149 if e.errno == errno.EAGAIN: 149 if e.errno == errno.EAGAIN:
150 if retries_left <= 0: 150 if retries_left <= 0:
151 _log.warn("Failed to kill pid %s. Too many EAGAIN error s." % pid) 151 _log.warning("Failed to kill pid %s. Too many EAGAIN er rors.", pid)
152 continue 152 continue
153 if e.errno == errno.ESRCH: # The process does not exist. 153 if e.errno == errno.ESRCH: # The process does not exist.
154 return 154 return
155 if e.errno == errno.EPIPE: # The process has exited already on cygwin 155 if e.errno == errno.EPIPE: # The process has exited already on cygwin
156 return 156 return
157 if e.errno == errno.ECHILD: 157 if e.errno == errno.ECHILD:
158 # Can't wait on a non-child process, but the kill worked. 158 # Can't wait on a non-child process, but the kill worked.
159 return 159 return
160 if e.errno == errno.EACCES and sys.platform == 'cygwin': 160 if e.errno == errno.EACCES and sys.platform == 'cygwin':
161 # Cygwin python sometimes can't kill native processes. 161 # Cygwin python sometimes can't kill native processes.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 # run_command automatically decodes to unicode() unless explicitly told not to. 371 # run_command automatically decodes to unicode() unless explicitly told not to.
372 if decode_output: 372 if decode_output:
373 output = output.decode(self._child_process_encoding(), errors="repla ce") 373 output = output.decode(self._child_process_encoding(), errors="repla ce")
374 374
375 # wait() is not threadsafe and can throw OSError due to: 375 # wait() is not threadsafe and can throw OSError due to:
376 # http://bugs.python.org/issue1731717 376 # http://bugs.python.org/issue1731717
377 exit_code = process.wait() 377 exit_code = process.wait()
378 378
379 if debug_logging: 379 if debug_logging:
380 _log.debug('"%s" took %.2fs' % (self.command_for_printing(args), tim e.time() - start_time)) 380 _log.debug('"%s" took %.2fs', self.command_for_printing(args), time. time() - start_time)
381 381
382 if return_exit_code: 382 if return_exit_code:
383 return exit_code 383 return exit_code
384 384
385 if exit_code: 385 if exit_code:
386 script_error = ScriptError(script_args=args, 386 script_error = ScriptError(script_args=args,
387 exit_code=exit_code, 387 exit_code=exit_code,
388 output=output, 388 output=output,
389 cwd=cwd) 389 cwd=cwd)
390 (error_handler or self.default_error_handler)(script_error) 390 (error_handler or self.default_error_handler)(script_error)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 pool.close() 457 pool.close()
458 pool.join() 458 pool.join()
459 459
460 460
461 def _run_command_thunk(cmd_line_and_cwd): 461 def _run_command_thunk(cmd_line_and_cwd):
462 # Note that this needs to be a bare module (and hence Picklable) method to w ork with multiprocessing.Pool. 462 # Note that this needs to be a bare module (and hence Picklable) method to w ork with multiprocessing.Pool.
463 (cmd_line, cwd) = cmd_line_and_cwd 463 (cmd_line, cwd) = cmd_line_and_cwd
464 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su bprocess.PIPE) 464 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su bprocess.PIPE)
465 stdout, stderr = proc.communicate() 465 stdout, stderr = proc.communicate()
466 return (proc.returncode, stdout, stderr) 466 return (proc.returncode, stdout, stderr)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698