Run wget with -nv instead of -q, so it will display HTTP errors.
This adds one extra line of output when a download is successful, after the progress bar. I don't much like that, but wget does not provide a way to show HTTP errors without it.
This commit is contained in:
parent
3488679a81
commit
4a397b5313
5 changed files with 40 additions and 5 deletions
|
@ -34,7 +34,7 @@ tests =
|
||||||
, TestCase "rsync" $ requireCmd "rsync" "rsync --version >/dev/null"
|
, TestCase "rsync" $ requireCmd "rsync" "rsync --version >/dev/null"
|
||||||
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
|
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
|
||||||
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
||||||
, TestCase "wget supports -q --show-progress" checkWgetQuietProgress
|
, TestCase "wget unclutter options" checkWgetUnclutter
|
||||||
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
||||||
, TestCase "nice" $ testCmd "nice" "nice true >/dev/null"
|
, TestCase "nice" $ testCmd "nice" "nice true >/dev/null"
|
||||||
, TestCase "ionice" $ testCmd "ionice" "ionice -c3 true >/dev/null"
|
, TestCase "ionice" $ testCmd "ionice" "ionice -c3 true >/dev/null"
|
||||||
|
@ -105,8 +105,8 @@ getGitVersion = go =<< getEnv "FORCE_GIT_VERSION"
|
||||||
error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
|
error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
|
||||||
return $ Config "gitversion" $ StringConfig $ show v
|
return $ Config "gitversion" $ StringConfig $ show v
|
||||||
|
|
||||||
checkWgetQuietProgress :: Test
|
checkWgetUnclutter :: Test
|
||||||
checkWgetQuietProgress = Config "wgetquietprogress" . BoolConfig
|
checkWgetUnclutter = Config "wgetunclutter" . BoolConfig
|
||||||
. maybe False (>= normalize "1.16")
|
. maybe False (>= normalize "1.16")
|
||||||
<$> getWgetVersion
|
<$> getWgetVersion
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ git-annex (6.20170215) UNRELEASED; urgency=medium
|
||||||
webapp and test suite.
|
webapp and test suite.
|
||||||
* adjust: Fix behavior when used in a repository that contains
|
* adjust: Fix behavior when used in a repository that contains
|
||||||
submodules.
|
submodules.
|
||||||
|
* Run wget with -nv instead of -q, so it will display HTTP errors.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 14 Feb 2017 15:54:25 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 14 Feb 2017 15:54:25 -0400
|
||||||
|
|
||||||
|
|
|
@ -279,8 +279,8 @@ download' quiet url file uo = do
|
||||||
-}
|
-}
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
wgetparams = concat
|
wgetparams = concat
|
||||||
[ if Build.SysConfig.wgetquietprogress && not quiet
|
[ if Build.SysConfig.wgetunclutter && not quiet
|
||||||
then [Param "-q", Param "--show-progress"]
|
then [Param "-nv", Param "--show-progress"]
|
||||||
else []
|
else []
|
||||||
, [ Param "--clobber", Param "-c", Param "-O"]
|
, [ Param "--clobber", Param "-c", Param "-O"]
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2017-02-20T18:50:18Z"
|
||||||
|
content="""
|
||||||
|
Probably wget is just failing to download the url sometimes.
|
||||||
|
Eg, `git annex addurl http://localhost/dne` fails with the same not useful
|
||||||
|
output.
|
||||||
|
|
||||||
|
wget is run with -q, which is the only way to turn off all its informational
|
||||||
|
messages, but unfortunately that also turns off display of HTTP error messages.
|
||||||
|
|
||||||
|
Using -nv instead of -q would display HTTP errors,
|
||||||
|
but also 1 extra line of output once the download is complete.
|
||||||
|
I suppose that's worth the trade-off.
|
||||||
|
"""]]
|
|
@ -0,0 +1,18 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 2"""
|
||||||
|
date="2017-02-20T19:15:18Z"
|
||||||
|
content="""
|
||||||
|
In general, the --json output does include a "note" with any
|
||||||
|
available message about why an operation failed.
|
||||||
|
|
||||||
|
Since wget outputs HTTP errors to stdout, there's no way to capture the actual
|
||||||
|
message for json, and so swiching to wget -nv won't improve the json.
|
||||||
|
(curl also outputs HTTP errors to stdout too, so it's no better)
|
||||||
|
|
||||||
|
Short of using a HTTP library for url downloads in --json mode,
|
||||||
|
I don't see a way to fix this. It would not be hard to use a HTTP library
|
||||||
|
and propagate the HTTP errors into the json "note", but it might be hard to
|
||||||
|
get resumption of partial downloads to work as well with a HTTP library as
|
||||||
|
it works with wget.
|
||||||
|
""]]
|
Loading…
Add table
Reference in a new issue