2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Windows can't run .sh files, so this is a small python wrapper around
16 if sys.platform in ['win32', 'cygwin']:
19 # This script is called by gclient. gclient opens its hooks subprocesses with
20 # (stdout=subprocess.PIPE, stderr=subprocess.STDOUT) and then does custom
21 # output processing that breaks printing '\r' characters for single-line
22 # updating status messages as printed by curl and wget.
23 # Work around this by setting stderr of the update.sh process to stdin (!):
24 # gclient doesn't redirect stdin, and while stdin itself is read-only, a
25 # dup()ed sys.stdin is writable, try
26 # fd2 = os.dup(sys.stdin.fileno()); os.write(fd2, 'hi')
27 # TODO: Fix gclient instead, http://crbug.com/95350
28 return subprocess.call(
29 [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:],
30 stderr=os.fdopen(os.dup(sys.stdin.fileno())))
33 if __name__ == '__main__':