From: Graham Knop Date: Wed, 20 Nov 2013 05:36:18 +0000 (-0500) Subject: fix powershell output for use with invoke-expression X-Git-Tag: v2.000_000~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Flocal-lib.git;a=commitdiff_plain;h=4e1bf182fbcc68084cabf865cea917a7e1897e68 fix powershell output for use with invoke-expression --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index f1a6dd6..68baba7 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -331,6 +331,10 @@ sub environment_vars_string_for { } $out .= $self->$build_method($name, $value); } + my $wrap_method = 'wrap_' . $self->shelltype . '_output'; + if ($self->can($wrap_method)) { + return $self->$wrap_method($out); + } return $out; } @@ -360,8 +364,12 @@ sub build_powershell_env_declaration { my ($class, $name, $args) = @_; my $value = $class->_interpolate($args, '$env:', '', '"', '`'); defined $value - ? qq{\$env:$name = "$value"\n} - : "Remove-Item Env:\\$name\n"; + ? qq{\$env:$name = "$value";\n} + : "Remove-Item Env:\\$name;\n"; +} +sub wrap_powershell_output { + my ($class, $out) = @_; + return $out || " \n"; }