1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 12:45:20 +03:00
aports/community/perl-command-runner/remove-win32-shellquote-dep.patch

39 lines
890 B
Diff

Avoid having to add perl-win32-shellquote aport
which won't be used anyway as this isn't Windows
--- a/lib/Command/Runner/Quote.pm
+++ b/lib/Command/Runner/Quote.pm
@@ -2,15 +2,31 @@
use strict;
use warnings;
-use Win32::ShellQuote ();
use String::ShellQuote ();
use Exporter 'import';
our @EXPORT_OK = qw(quote quote_win32 quote_unix);
+sub win32_quote_literal {
+ my ($text, $force) = @_;
+
+ # basic argument quoting. uses backslashes and quotes to escape
+ # everything.
+ if (!$force && $text ne '' && $text !~ /[ \t\n\x0b"]/) {
+ # no quoting needed
+ }
+ else {
+ $text =~ s{(\\*)(?="|\z)}{$1$1}g;
+ $text =~ s{"}{\\"}g;
+ $text = qq{"$text"};
+ }
+
+ return $text;
+}
+
sub quote_win32 {
my $str = shift;
- Win32::ShellQuote::quote_literal($str, 1);
+ win32_quote_literal($str, 1);
}
sub quote_unix {