Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foundryup does not properly exit on errors in piped commands #6329

Closed
2 tasks done
geoff-vball opened this issue Nov 16, 2023 · 0 comments · Fixed by #6352
Closed
2 tasks done

foundryup does not properly exit on errors in piped commands #6329

geoff-vball opened this issue Nov 16, 2023 · 0 comments · Fixed by #6352
Labels
T-bug Type: bug

Comments

@geoff-vball
Copy link

geoff-vball commented Nov 16, 2023

Component

Foundryup

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (8c11482 2023-11-16T00:32:37.968294000Z)

What command(s) is the bug in?

foundryup

Operating System

macOS (Apple Silicon)

Describe the bug

Since piped commands run in a subshell, when we have something like ensure download "$BIN_ARCHIVE_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR", foundryup will not properly exit if tar fails.

Steps to reproduce:
foundryup -v abc

Output:

foundryup: installing foundry (version abc, tag abc)
foundryup: downloading latest forge, cast, anvil, and chisel
############################################################################################################################################################################################################################################## 100.0%
tar: Error opening archive: Unrecognized archive format
foundryup: command failed: tar -xzC <redacted>/.foundry/bin
foundryup: downloading manpages
############################################################################################################################################################################################################################################## 100.0%
tar: Error opening archive: Unrecognized archive format
foundryup: installed - forge 0.2.0 (8c11482 2023-11-16T00:32:37.968294000Z)
foundryup: installed - cast 0.2.0 (8c11482 2023-11-16T00:32:38.016628000Z)
foundryup: installed - anvil 0.2.0 (8c11482 2023-11-16T00:32:37.882016000Z)
foundryup: installed - chisel 0.2.0 (8c11482 2023-11-16T00:32:37.924862000Z)
foundryup: done!

Explanation:
When curling a file that doesn't exist, curl seems to exit with code 0 when piping that output, and since the piped output
to tar runs in a subshell, it doesn't exit the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant