[pve-devel] [PATCH common] add keeplocale parameter to run_command
Dominik Csapak
d.csapak at proxmox.com
Tue Feb 28 12:06:35 CET 2017
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 <d.csapak at proxmox.com>
---
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.1.4
More information about the pve-devel
mailing list