tools/download.sh exit conditions broken
See original GitHub issueEvery instance of exit 2 >&2 "message here"
should be replaced with:
>&2 echo "message here"
exit 2
The former does not work, and does not exit either, because exit
is called with too many arguments. This then leads to odd failure conditions later in the script.
Patch for tools.sh follows:
diff --git a/tools/download.sh b/tools/download.sh
index e37acf8..0617985 100755
--- a/tools/download.sh
+++ b/tools/download.sh
@@ -27,18 +27,22 @@ case "$OSTYPE" in
version=ubuntu1.16.04.1_amd64.deb
;;
*)
- exit 2 >&2 "Ubuntu $VERSION_ID is not supported!"
+ >&2 echo "Ubuntu $VERSION_ID is not supported!"
+ exit 2
esac
;;
*)
- exit 2 >&2 "$NAME is not supported!"
+ >&2 echo "$NAME is not supported!"
+ exit 2
+ ;;
esac
;;
darwin*)
version=pkg
;;
*)
- exit 2 >&2 "$OSTYPE is not supported!"
+ >&2 echo "$OSTYPE is not supported!"
+ exit 2
;;
esac
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Exit sh script if condition is met
I have a sh-script which should get the number of lines on a specific file; the whole sh script should be exit/stopped as...
Read more >In a Bash script, how can I exit the entire script if a certain ...
Try this statement: exit 1. Replace 1 with appropriate error codes. See also Exit Codes With Special Meanings.
Read more >How to stop the bash script when a condition fails?
I am trying to stop a script execution if a certain condition fails,. e.g. false || echo "Obvious error because its false on...
Read more >ssh and shell through ssh : how to exit? - bash
Everything is going fine but once the script is finished, the connection is not closed. I Have to press CTRL-C to break the...
Read more >Android Debug Bridge (adb) | Android Studio
Find out about the Android Debug Bridge, a versatile command-line tool that lets you communicate with a device.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This might need its own issue, but seems related: build.psm1 is chock full of hard coded distribution checks, which is causing build failures on Arch Linux (PowerShell itself runs fine with freshly built files from the
dotnet-cli
package from the AUR dropped in to the /opt/microsoft/powershell-foo directory) and will act as a significant blocker for bootstrapping on Alpine, Debian, or any other distribution not already listed.This is inefficient, awkward, and wrongheaded. An upstream build system like PowerShell’s should focus on building the executables and libraries needed, and possibly include an installation makefile/psbuild target to drop them into a relative directory.
Let the distributions’ package management teams take advantage of that relative-directory installation target and handle packaging themselves. I guarantee they’ll do a better job than Microsoft will, judging by the inadequate code quality in all the Unix-native stuff like build.sh so far. Even Valve recognizes the benefit their platform receives from allowing binary redistribution and repackaging of the Steam application for Linux. The only reason to not delegate packaging to the distributions is if Microsoft was planning on taking PowerShell so proprietary that even binary redistribution is banned.
That’s not anything we have to worry about, RIGHT?
For the curious: