Skip to content

Commit

Permalink
Pass --execname to nqp thus nqp::execname() works (#479)
Browse files Browse the repository at this point in the history
Only for MoarVM backend, now `nqp::execname()` give out the execution path as defined.
  • Loading branch information
tisonkun committed Jul 11, 2018
1 parent 668be5c commit 2e053da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tools/build/gen-moar-runner.pl
Expand Up @@ -9,10 +9,10 @@
my ($moar) = @ARGV;

if ($^O eq 'MSWin32') {
my $install_to = 'nqp-m.bat';
my $install_to = 'nqp-m.bat';
open my $fh, ">", $install_to
or die "Could not open $install_to: $!";
print $fh '@ "' . $moar . '" nqp.moarvm %*' . "\n";
print $fh '@ "' . $moar . '" --execname="%%\~dpf0" nqp.moarvm %*' . "\n";
close $fh
or die "Could not close $install_to: $!";
}
Expand All @@ -22,7 +22,7 @@
or die "Could not open $install_to: $!";
printf $fh <<'EOS', $moar;
#!/bin/sh
exec %s nqp.moarvm "$@"
exec %s --execname="$0" nqp.moarvm "$@"
EOS
close $fh
or die "Could not close $install_to: $!";
Expand Down
4 changes: 2 additions & 2 deletions tools/build/install-moar-runner.pl
Expand Up @@ -19,7 +19,7 @@
my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-m.bat');
open my $fh, ">", $install_to
or die "Could not open $install_to: $!";
print $fh '@ "' . $moar . '" --libpath="' . $lib_dir . '" "' . $nqp_mvm . '" %*' . "\n";
print $fh '@ "' . $moar . '" --execname="%%\~dpf0" --libpath="' . $lib_dir . '" "' . $nqp_mvm . '" %*' . "\n";
close $fh
or die "Could not close $install_to: $!";
}
Expand All @@ -28,7 +28,7 @@
open my $fh, ">", $install_to
or die "Could not open $install_to: $!";
print $fh "#!/bin/sh\n";
print $fh "exec $moar --libpath=$lib_dir $nqp_mvm \"\$\@\"\n";
print $fh "exec $moar --execname=\"\$0\" --libpath=$lib_dir $nqp_mvm \"\$\@\"\n";
close $fh
or die "Could not close $install_to: $!";
chmod 0755, $install_to;
Expand Down

0 comments on commit 2e053da

Please sign in to comment.