Skip to content

dmd-script: Expand @rsp arguments in-place in ARGV #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dmd-script
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,11 @@ while ( $arg_i < scalar(@ARGV) ) {
} elsif ( $arg =~ m/^-.+$/ ) {
errorExit "unrecognized switch '$arg'";
} elsif ( $arg =~ m/^\@(.+)$/i ) {
# Append response file to end of ARGV.
open(my $rsp_fh, "<", $1) or die("Can't read response file: $!");
my $rsp = do { local $/; <$rsp_fh> };
close($rsp_fh);

my @new_args;
while (length $rsp) {
if ($rsp =~ m/^"(([^\\"]|\\.)*(\\\\)*)"\s*/ ) {
$arg = $1;
Expand All @@ -577,8 +577,10 @@ while ( $arg_i < scalar(@ARGV) ) {
$arg = $1;
$rsp = $';
}
push @ARGV, $arg;
push @new_args, $arg;
}
# Place the response arguments after the @path argument
splice @ARGV, $arg_i, 0, @new_args;
} elsif ( $arg =~ m/^.+\.d$/i ||
$arg =~ m/^.+\.dd$/i ||
$arg =~ m/^.+\.di$/i) {
Expand Down