File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 28
28
_MODE_ROOT_POINTER = "root_pointer"
29
29
30
30
31
+ class PreprocessorError (Exception ):
32
+ pass
33
+
34
+
31
35
def is_c_source (fname ):
32
36
return os .path .splitext (fname )[1 ] in [".c" ]
33
37
@@ -57,7 +61,10 @@ def preprocess():
57
61
58
62
def pp (flags ):
59
63
def run (files ):
60
- return subprocess .check_output (args .pp + flags + files )
64
+ try :
65
+ return subprocess .check_output (args .pp + flags + files )
66
+ except subprocess .CalledProcessError as er :
67
+ raise PreprocessorError (str (er ))
61
68
62
69
return run
63
70
@@ -208,7 +215,12 @@ class Args:
208
215
for k , v in named_args .items ():
209
216
setattr (args , k , v )
210
217
211
- preprocess ()
218
+ try :
219
+ preprocess ()
220
+ except PreprocessorError as er :
221
+ print (er )
222
+ sys .exit (1 )
223
+
212
224
sys .exit (0 )
213
225
214
226
args .mode = sys .argv [2 ]
You can’t perform that action at this time.
0 commit comments