Workaround issue with stdin on Windows.
On Windows, sometimes the compare_videos.py script fails because
the inherited stdin handle from the parent process fails.
It seems we can work around this by passing null to stdin to
the subprocesses, since we're not using it anyway.
The errors looked like this:
Traceback (most recent call last):
File "C:\b\build\slave\Win7_Tester\build\src\third_party/webrtc/tools/compare_videos.py", line 116, in <module>
sys.exit(main())
File "C:\b\build\slave\Win7_Tester\build\src\third_party/webrtc/tools/compare_videos.py", line 91, in main
barcode_decoder = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
File "C:\b\depot_tools\python_bin\lib\subprocess.py", line 588, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\b\depot_tools\python_bin\lib\subprocess.py", line 686, in _get_handles
p2cread = GetStdHandle(STD_INPUT_HANDLE)
WindowsError: [Error 6] The handle is invalid
Example from http://build.chromium.org/p/chromium.webrtc/builders/Win7%20Tester/builds/4498/steps/webrtc_manual_browser_tests_test/logs/stdio
BUG=302915
TEST=successful runs on Windows and Linux.
R=phoglund@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2334005
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4902 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -80,6 +80,11 @@ def main():
|
|||||||
# Run barcode decoder on the test video to identify frame numbers.
|
# Run barcode decoder on the test video to identify frame numbers.
|
||||||
path_to_decoder = os.path.join(SCRIPT_DIR, 'barcode_tools',
|
path_to_decoder = os.path.join(SCRIPT_DIR, 'barcode_tools',
|
||||||
'barcode_decoder.py')
|
'barcode_decoder.py')
|
||||||
|
|
||||||
|
# On Windows, sometimes the inherited stdin handle from the parent process
|
||||||
|
# fails. Work around this by passing null to stdin to the subprocesses.
|
||||||
|
null_filehandle = open(os.devnull, 'r')
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
sys.executable,
|
sys.executable,
|
||||||
path_to_decoder,
|
path_to_decoder,
|
||||||
@@ -88,7 +93,8 @@ def main():
|
|||||||
'--yuv_frame_height=%d' % options.yuv_frame_height,
|
'--yuv_frame_height=%d' % options.yuv_frame_height,
|
||||||
'--stats_file=%s' % options.stats_file,
|
'--stats_file=%s' % options.stats_file,
|
||||||
]
|
]
|
||||||
barcode_decoder = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
|
barcode_decoder = subprocess.Popen(cmd, stdin=null_filehandle,
|
||||||
|
stdout=sys.stdout, stderr=sys.stderr)
|
||||||
barcode_decoder.wait()
|
barcode_decoder.wait()
|
||||||
if barcode_decoder.returncode != 0:
|
if barcode_decoder.returncode != 0:
|
||||||
print 'Failed to run barcode decoder script.'
|
print 'Failed to run barcode decoder script.'
|
||||||
@@ -104,7 +110,8 @@ def main():
|
|||||||
'--width=%d' % options.yuv_frame_width,
|
'--width=%d' % options.yuv_frame_width,
|
||||||
'--height=%d' % options.yuv_frame_height,
|
'--height=%d' % options.yuv_frame_height,
|
||||||
]
|
]
|
||||||
frame_analyzer = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
|
frame_analyzer = subprocess.Popen(cmd, stdin=null_filehandle,
|
||||||
|
stdout=sys.stdout, stderr=sys.stderr)
|
||||||
frame_analyzer.wait()
|
frame_analyzer.wait()
|
||||||
if frame_analyzer.returncode != 0:
|
if frame_analyzer.returncode != 0:
|
||||||
print 'Failed to run frame analyzer.'
|
print 'Failed to run frame analyzer.'
|
||||||
|
|||||||
Reference in New Issue
Block a user