[pve-devel] [pve-common 1/1] setup_default_cli_env - set binmode ':encoding(locale)' for STDOUT and STDERR

Dietmar Maurer dietmar at proxmox.com
Fri Jun 29 10:09:07 CEST 2018


Sigh! I guess this is too much magic - Now I get:

syswrite() is deprecated on :utf8 handles at
/usr/share/perl5/PVE/APIClient/PTY.pm line 194.

So IMHO it is better to avoid binmode. 

> On June 29, 2018 at 9:46 AM Dietmar Maurer <dietmar at proxmox.com> wrote:
> 
> 
> So that we can output wide charachters without perl warnings ...
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  src/PVE/RESTEnvironment.pm | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
> index 32ffdd1..8bf5722 100644
> --- a/src/PVE/RESTEnvironment.pm
> +++ b/src/PVE/RESTEnvironment.pm
> @@ -142,6 +142,9 @@ sub init {
>  sub setup_default_cli_env {
>      my ($class, $username) = @_;
>  
> +    binmode(STDOUT, ':encoding(locale)');
> +    binmode(STDERR, ':encoding(locale)');
> +
>      $class = ref($class) || $class;
>  
>      $username //= 'root at pam';
> -- 
> 2.11.0
> 
> 




More information about the pve-devel mailing list