In *_pipe print the command that failed if it fails. Fixed old calls to mypopen.
In *_pipe print the command that failed if it fails. Fixed old calls to mypopen. Signed-off-by: Simon Hausmann <simon@lst.de>
Simon Hausmann committed
May 28, 2007 at 19:23 UTC
9226c03c3279d66e2dea21a7a3e9f187e5ee9b9a
1 file changed
+5
-5
contrib/fast-import/git-p4
+5
-5
@@ -24,7 +24,7 @@ def write_pipe(c, str):
24
pipe = os.popen(c, 'w')
25
val = pipe.write(str)
26
if pipe.close():
27
- sys.stderr.write('Command failed')
27
+ sys.stderr.write('Command failed: %s' % c)
28
sys.exit(1)
29
30
return val
@@ -36,7 +36,7 @@ def read_pipe(c):
36
pipe = os.popen(c, 'rb')
37
val = pipe.read()
38
if pipe.close():
39
- sys.stderr.write('Command failed')
39
+ sys.stderr.write('Command failed: %s' % c)
40
sys.exit(1)
41
42
return val
@@ -49,7 +49,7 @@ def read_pipe_lines(c):
49
pipe = os.popen(c, 'rb')
50
val = pipe.readlines()
51
if pipe.close():
52
- sys.stderr.write('Command failed')
52
+ sys.stderr.write('Command failed: %s' % c)
53
sys.exit(1)
54
55
return val
@@ -157,7 +157,7 @@ def gitBranchExists(branch):
157
return proc.wait() == 0;
158
159
def gitConfig(key):
160
- return mypopen("git config %s" % key).read()[:-1]
160
+ return os.popen("git config %s" % key, "rb").read()[:-1]
161
162
class Command:
163
def __init__(self):
@@ -861,7 +861,7 @@ class P4Sync(Command):
861
if not self.silent:
862
print "Creating/updating branch(es) in %s based on origin branch(es)" % self.refPrefix
863
864
- for line in mypopen("git rev-parse --symbolic --remotes"):
864
+ for line in read_pipe_lines("git rev-parse --symbolic --remotes"):
865
if (not line.startswith("origin/")) or line.endswith("HEAD\n"):
866
continue
867