@@ -3210,9 +3210,15 @@ sub runjob {
3210
3210
$ENV {" SWIFT_WORKER_PID" } = $WORKERPID ;
3211
3211
unshift @$JOBARGS , $executable ;
3212
3212
wlog DEBUG, " Command: @$JOBARGS \n " ;
3213
+
3214
+ my $dir ;
3213
3215
if (defined $$JOB {" directory" }) {
3214
- wlog DEBUG, " chdir: $$JOB {directory}\n " ;
3215
- chdir $$JOB {" directory" };
3216
+ $dir = $$JOB {" directory" };
3217
+ wlog DEBUG, " chdir: $dir \n " ;
3218
+ chdir $dir ;
3219
+ }
3220
+ else {
3221
+ $dir = " ." ;
3216
3222
}
3217
3223
if (defined $sout ) {
3218
3224
wlog DEBUG, " STDOUT: $sout \n " ;
@@ -3234,12 +3240,12 @@ sub runjob {
3234
3240
$JOBARGS = moveSwiftwrapArgsToFile(" ." , $JOBARGS );
3235
3241
}
3236
3242
3237
- my $launcherr = execPortable($executable , $JOBARGS );
3243
+ my $launcherr = execPortable($executable , $JOBARGS , $dir );
3238
3244
exitSubprocess($WR , " Could not execute $executable : $launcherr " );
3239
3245
}
3240
3246
3241
3247
sub execPortable {
3242
- my ($executable , $args ) = @_ ;
3248
+ my ($executable , $args , $dir ) = @_ ;
3243
3249
3244
3250
if ($WINDOWS ) {
3245
3251
@@ -3256,7 +3262,7 @@ sub execPortable {
3256
3262
wlog DEBUG, " Windows process canceled before it started\n " ;
3257
3263
exit (-1);
3258
3264
}
3259
- if (!Win32::Process::Create($process , $fullpath , $cmdline , 0, NORMAL_PRIORITY_CLASS(), " . " )) {
3265
+ if (!Win32::Process::Create($process , $fullpath , $cmdline , 0, NORMAL_PRIORITY_CLASS(), $dir )) {
3260
3266
my $err = Win32::FormatMessage(Win32::GetLastError());
3261
3267
wlog DEBUG, " Failed to create process: $err \n " ;
3262
3268
return $err ;
0 commit comments