@@ -132,14 +132,30 @@ class ProcessException(Exception):
132
132
def popen (command , stdin = None , ** kwargs ):
133
133
# print for debugging
134
134
log ('"' + ' ' .join (command )+ '"' )
135
- proc = subprocess .Popen (command , ** kwargs )
136
-
135
+ try :
136
+ proc = subprocess .Popen (command , ** kwargs )
137
+ except OSError as e :
138
+ if e [0 ] == 2 :
139
+ error (
140
+ "Could not execute \" %s\" .\n "
141
+ "Please verify that it's installed and accessible from your current path by executing \" %s\" .\n " % (command [0 ], command [0 ]), e [0 ])
142
+ else :
143
+ raise
144
+
137
145
if proc .wait () != 0 :
138
146
raise ProcessException (proc .returncode )
139
147
140
148
def pquery (command , stdin = None , ** kwargs ):
141
149
#log("Query "+' '.join(command)+" in "+os.getcwd())
142
- proc = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , ** kwargs )
150
+ try :
151
+ proc = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , ** kwargs )
152
+ except OSError as e :
153
+ if e [0 ] == 2 :
154
+ error (
155
+ "Could not execute \" %s\" .\n "
156
+ "Please verify that it's installed and accessible from your current path by executing \" %s\" .\n " % (command [0 ], command [0 ]), e [0 ])
157
+ else :
158
+ raise
143
159
stdout , _ = proc .communicate (stdin )
144
160
145
161
if proc .returncode != 0 :
@@ -1426,8 +1442,7 @@ def toolchain(name=None):
1426
1442
if e [0 ] == 2 :
1427
1443
error (
1428
1444
"Could not detect one of the command-line tools.\n "
1429
- "Please verify that you have Git and Mercurial installed and accessible from your current path by executing commands \" git\" and \" hg\" .\n "
1430
- "Hint: check the last executed command above." , e [0 ])
1445
+ "You could retry the last command with \" -v\" flag for verbose output\n " , e [0 ])
1431
1446
else :
1432
1447
error ('OS Error: %s' % e [1 ], e [0 ])
1433
1448
except KeyboardInterrupt as e :
0 commit comments