mirror of
https://github.com/nmattia/niv.git
synced 2024-09-19 11:27:40 +03:00
Show command when nix-prefetch-url fails
This commit is contained in:
parent
5f35efd949
commit
3c7cecd8e6
@ -138,7 +138,7 @@ nixPrefetchURL unpack turl@(T.unpack -> url) = do
|
|||||||
(exitCode, sout, serr) <- runNixPrefetch
|
(exitCode, sout, serr) <- runNixPrefetch
|
||||||
case (exitCode, lines sout) of
|
case (exitCode, lines sout) of
|
||||||
(ExitSuccess, l:_) -> pure $ T.pack l
|
(ExitSuccess, l:_) -> pure $ T.pack l
|
||||||
_ -> abortNixPrefetchExpectedOutput (T.pack sout) (T.pack serr)
|
_ -> abortNixPrefetchExpectedOutput (T.pack <$> args) (T.pack sout) (T.pack serr)
|
||||||
where
|
where
|
||||||
args = (if unpack then ["--unpack"] else []) <> [ url, "--name", sanitizeName basename]
|
args = (if unpack then ["--unpack"] else []) <> [ url, "--name", sanitizeName basename]
|
||||||
runNixPrefetch = readProcessWithExitCode "nix-prefetch-url" args ""
|
runNixPrefetch = readProcessWithExitCode "nix-prefetch-url" args ""
|
||||||
@ -150,12 +150,12 @@ nixPrefetchURL unpack turl@(T.unpack -> url) = do
|
|||||||
-- (note: we assume they don't begin with a period)
|
-- (note: we assume they don't begin with a period)
|
||||||
isOk = \c -> isAlphaNum c || T.any (c ==) "+-._?="
|
isOk = \c -> isAlphaNum c || T.any (c ==) "+-._?="
|
||||||
|
|
||||||
abortNixPrefetchExpectedOutput :: T.Text -> T.Text -> IO a
|
abortNixPrefetchExpectedOutput :: [T.Text] -> T.Text -> T.Text -> IO a
|
||||||
abortNixPrefetchExpectedOutput sout serr = abort $ [s|
|
abortNixPrefetchExpectedOutput args sout serr = abort $ [s|
|
||||||
Could not read the output of 'nix-prefetch-url'. This is a bug. Please create a
|
Could not read the output of 'nix-prefetch-url'. This is a bug. Please create a
|
||||||
ticket:
|
ticket:
|
||||||
|
|
||||||
https://github.com/nmattia/niv/issues/new
|
https://github.com/nmattia/niv/issues/new
|
||||||
|
|
||||||
Thanks! I'll buy you a beer.
|
Thanks! I'll buy you a beer.
|
||||||
|] <> T.unlines ["stdout: ", sout, "stderr: ", serr]
|
|] <> T.unlines ["command: ", "nix-prefetch-url" <> T.unwords args, "stdout: ", sout, "stderr: ", serr]
|
||||||
|
Loading…
Reference in New Issue
Block a user