From 147ebd92ec0cef842bd459252096db6c0bcdfd18 Mon Sep 17 00:00:00 2001 From: Luke Sampson Date: Thu, 26 Sep 2013 18:17:17 +1000 Subject: [PATCH] don't try to show download % if output is redirected, see lukesampson/psutils#2 --- lib/install.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/install.ps1 b/lib/install.ps1 index 2bb2d0f9..4868c2e6 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -46,6 +46,12 @@ function dl_with_cache($app, $version, $url, $to) { } function dl_progress($url, $to) { + if([console]::isoutputredirected) { + # can't set cursor position: just do simple download + (new-object net.webclient).downloadfile($url, $to) + return + } + $left = [console]::cursorleft $top = [console]::cursortop