@@ -78,7 +78,7 @@ def run_security_analyser_pipeline(
78
78
"-R" , results_dir ,
79
79
"-T" , temporary_dir ,
80
80
"--name" , relative_binary_path ,
81
- "--verbosity" , "9" ]
81
+ "--verbosity" , "9" ] # TODO: we should rather pass the verbosity to this function.
82
82
cmdline .extend (extra_args )
83
83
if "SECURITY_ANALYSER_END_TO_END_TESTS_EXTRA_ARGS" in os .environ :
84
84
cmdline .extend (os .environ ["SECURITY_ANALYSER_END_TO_END_TESTS_EXTRA_ARGS" ].split ("," ))
@@ -87,12 +87,24 @@ def run_security_analyser_pipeline(
87
87
temp_dir_deleter (results_dir ), \
88
88
temp_dir_deleter (temporary_dir ):
89
89
90
+ def quote_pathnames_in_command_line (cmdline ):
91
+ assert isinstance (cmdline , list ) and len (cmdline ) > 0
92
+ result = cmdline [:1 ]
93
+ for idx in range (1 , len (cmdline )):
94
+ if cmdline [idx - 1 ] in ["-C" , "-I" , "-R" , "-T" ] or \
95
+ (cmdline [idx - 1 ] == "--name" and " " in cmdline [idx ]):
96
+ result .append ("'" + cmdline [idx ] + "'" )
97
+ else :
98
+ result .append (cmdline [idx ])
99
+ return result
100
+
90
101
executable_runner = ExecutableRunner (cmdline )
91
102
(stdout , stderr , ret ) = executable_runner .run ()
92
103
if ret != 0 :
93
104
raise Exception (
94
- "Failed running %s:\n stdout:\n \n %s\n stderr\n \n %s" % \
95
- (cmdline , stdout , stderr ))
105
+ "Failed running \" %s\" :\n stdout:\n \n %s\n stderr\n \n %s" % \
106
+ (" " .join (quote_pathnames_in_command_line (cmdline )),
107
+ stdout , stderr ))
96
108
97
109
trace_list = \
98
110
os .path .join (
@@ -112,6 +124,8 @@ def run_security_analyser_pipeline(
112
124
inline_traces .append (trace_json )
113
125
114
126
if "SECURITY_ANALYSER_END_TO_END_TESTS_KEEP_RESULTS" in os .environ :
115
- print ("Test %s kept results (%s) and temporary directory (%s)" % (cmdline , results_dir , temporary_dir ))
127
+ print ("Test \" %s\" kept results (%s) and temporary directory (%s)" %
128
+ (" " .join (quote_pathnames_in_command_line (cmdline )),
129
+ results_dir , temporary_dir ))
116
130
117
131
return ErrorTraces (traces )
0 commit comments