Skip to content

Commit 036b22f

Browse files
authored
cp: support '--' terminator (#642)
* '--' option terminator is ignored when executing an external command * When debugging this I discovered the command list passed to system() strips off the '--' (technically Getopt::Long does) * Explicit terminator can be added between options and filenames %perl cp -- -a .. # before patch cp: missing destination file operand after '..' Try 'cp --help' for more information.
1 parent 6414320 commit 036b22f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/cp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sub run {
5858
# it doesn't.
5959
my @command = 'cp';
6060
push @command, map { "-$_" } grep { $opts->{$_} } qw(i f p v );
61-
push @command, @files, $destination;
61+
push @command, '--', @files, $destination;
6262

6363
my $rc = system { $command[0] } @command;
6464
return $rc >> 8;

0 commit comments

Comments
 (0)