From: Graham Knop Date: Thu, 2 Jan 2014 02:04:37 +0000 (-0500) Subject: fix errors when clearing nonexistent env vars in powershell X-Git-Tag: v2.000004~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7302e8e78fb14165bb8e175932bcecb642e75a7d;p=p5sagit%2Flocal-lib.git fix errors when clearing nonexistent env vars in powershell --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 172786a..dc5daef 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -426,7 +426,7 @@ sub build_powershell_env_declaration { my $value = $class->_interpolate($args, '$env:%s', '"', '`%s'); if (!$value) { - return qq{Remove-Item Env:\\$name;\n}; + return qq{Remove-Item -ErrorAction 0 Env:\\$name;\n}; } my $maybe_path_sep = qq{\$(if("\$env:$name"-eq""){""}else{"$_path_sep"})};