From 0f3f314ed72735ece3e0b826193b1dd23e69e37c Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 28 Feb 2017 12:06:35 +0100 Subject: [PATCH] add keeplocale parameter to run_command since the "lang" param has not worked, introduce a "keeplocale" parameter instead. the default behaviour is the same (set LC_ALL to 'C'), but we can use the parameter to keep the locale from the host (eg. for the vncshell) Signed-off-by: Dominik Csapak --- src/PVE/Tools.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 69c8730..fe35ef2 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -350,6 +350,7 @@ sub run_command { my $output; my $afterfork; my $noerr; + my $keeplocale; eval { @@ -374,6 +375,8 @@ sub run_command { $afterfork = $param{$p}; } elsif ($p eq 'noerr') { $noerr = $param{$p}; + } elsif ($p eq 'keeplocale') { + $keeplocale = $param{$p}; } else { die "got unknown parameter '$p' for run_command\n"; } @@ -397,13 +400,10 @@ sub run_command { my $writer = $input && $input =~ m/^<&/ ? $input : IO::File->new(); my $error = IO::File->new(); - # try to avoid locale related issues/warnings - my $lang = $param{lang} || 'C'; - my $orig_pid = $$; eval { - local $ENV{LC_ALL} = $lang; + local $ENV{LC_ALL} = 'C' if !$keeplocale; # suppress LVM warnings like: "File descriptor 3 left open"; local $ENV{LVM_SUPPRESS_FD_WARNINGS} = "1"; -- 2.39.2