@@ -105,12 +105,17 @@ def run_security_driver_script(
105
105
cmdline = ["python3" , pipeline_driver_path ]
106
106
cmdline .extend (extra_commandline )
107
107
108
- executable_runner = ExecutableRunner (cmdline )
109
- (stdout , stderr , ret ) = executable_runner .run ()
110
- if ret != 0 :
111
- raise Exception (
112
- "Failed running \" %s\" :\n stdout:\n \n %s\n stderr\n \n %s" % \
113
- (pretty_print_commandline (cmdline ), stdout , stderr ))
108
+ analyzer_home = utils .get_security_analyzer_home ()
109
+ if analyzer_home is None :
110
+ raise Exception ("Set SECURITY_SCANNER_HOME to a path containing the 'security-analyzer' binary" )
111
+
112
+ with utils .working_dir (analyzer_home ):
113
+ executable_runner = ExecutableRunner (cmdline )
114
+ (stdout , stderr , ret ) = executable_runner .run ()
115
+ if ret != 0 :
116
+ raise Exception (
117
+ "Failed running \" %s\" :\n stdout:\n \n %s\n stderr\n \n %s" % \
118
+ (pretty_print_commandline (cmdline ), stdout , stderr ))
114
119
115
120
116
121
def run_security_analyser_pipeline (
@@ -125,9 +130,6 @@ def run_security_analyser_pipeline(
125
130
if extra_args is None :
126
131
extra_args = []
127
132
128
- analyzer_home = utils .get_security_analyzer_home ()
129
- if analyzer_home is None :
130
- raise Exception ("Set SECURITY_SCANNER_HOME to a path containing the 'security-analyzer' binary" )
131
133
absolute_binary_path = \
132
134
os .path .join (base_path , relative_binary_path )
133
135
absolute_rules_path = \
@@ -158,8 +160,7 @@ def run_security_analyser_pipeline(
158
160
# optimisation matches:
159
161
cmdline .append ("--verify-csvsa-sparse-domains" )
160
162
161
- with utils .working_dir (analyzer_home ), \
162
- utils .temp_dir_deleter (results_dir , keep_results ), \
163
+ with utils .temp_dir_deleter (results_dir , keep_results ), \
163
164
utils .temp_dir_deleter (temporary_dir , keep_results ), \
164
165
utils .temp_dir_deleter (common_dir , keep_results ):
165
166
0 commit comments