]> Sergey Matveev's repositories - public-inbox.git/commitdiff
edit: fix portability of editor invocation
authorEric Wong <e@80x24.org>
Mon, 10 Jun 2019 23:53:46 +0000 (23:53 +0000)
committerEric Wong <e@80x24.org>
Fri, 14 Jun 2019 16:26:36 +0000 (16:26 +0000)
The eval was unnecessary, and $0 can't be "--".
Tested with /bin/sh on FreeBSD 11.2

script/public-inbox-edit

index 2e2c761620e154da65a395f6d9c6a12a756cb14f..6884fd0cb276623f64f4e27b7cb5e965c4140256 100755 (executable)
@@ -138,7 +138,7 @@ foreach my $to_edit (values %$found) {
 
        # run the editor, respecting spaces/quote
 retry_edit:
-       if (system(qw(sh -c), qq(eval "$editor" '"\$@"'), '--', $edit_fn)) {
+       if (system(qw(sh -c), $editor.' "$@"', $editor, $edit_fn)) {
                if (!(-t STDIN) && !$opt->{force}) {
                        die "E: $editor failed: $?\n";
                }