From: Graham Knop Date: Sat, 12 Oct 2013 08:31:22 +0000 (-0400) Subject: support powershell rt#88062 X-Git-Tag: v2.000_000~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fbbea0e711888bb65a8f357e277f175c23f160da;p=p5sagit%2Flocal-lib.git support powershell rt#88062 --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 1e4808e..78229ad 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -332,8 +332,18 @@ sub build_cmd_env_declaration { my $value = $class->_interpolate($args, '%', '%'); $value =~ s/"/\\"/g if defined $value; - return defined($value) ? qq{set ${name} "${value}"\n} : qq{set ${name}=\n}; + return qq{set $name=} . (defined($value) ? qq{"$value"} : '') . "\n"; } +sub build_powershell_env_declaration { + my ($class, $name, $args) = @_; + my $value = $class->_interpolate($args, '$env:'); + if (defined $value) { + $value =~ s/"/\\"/g; + return qq{\$env:$name = "$value"\n}; + } + return "Remove-Item Env:\\$name\n"; +} + sub _interpolate { my ($class, $args, $start, $end) = @_;