You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that the init and the install command behave differently when the tool decides that there are post-install commands to be executed.
Consider the following (executed in an ubuntu:24.04 container):
# apt-get update && apt-get install curl gpg -y
[...]
# curl -sL -O "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz"
# tar xfz "swiftly-$(uname -m).tar.gz"
# ./swiftly init --quiet-shell-followup -y
[...]
Installing Swift 6.1.0
[...]
Swift 6.1.0 installed successfully!
There are some dependencies that should be installed before using this toolchain.
You can run the following script as the system administrator (e.g. root) to prepare
your system:
apt-get -y install binutils git unzip gnupg2 libc6-dev libcurl4-openssl-dev libedit2 libgcc-13-dev libpython3-dev libstdc++-13-dev libxml2-dev libncurses-dev libz3-dev pkg-config tzdata zlib1g-dev
# echo $?
0
In short, when the init command preinstalls the latest version, the post-install command is just an advice, but the command succeeded. This is good.
However, if I am to install a different version with swiftly install, there are two possible outcomes.
If the --post-install-file parameter is not used, the command exits with status 1! That error exit code can, for example, break the build of the application on Heroku (ask me how I learned that).
# swiftly install --use 6.0.3
Installing Swift 6.0.3
[...]
Swift 6.0.3 installed successfully!
NOTE: We have updated some elements in your path and your shell may not yet be
aware of the changes. You can run this command to update your shell.
hash -r
Error:
There are some dependencies that should be installed before using this toolchain.
You can run the following script as the system administrator (e.g. root) to prepare
your system:
apt-get -y install binutils git unzip gnupg2 libc6-dev libcurl4-openssl-dev libedit2 libgcc-13-dev libpython3-dev libstdc++-13-dev libxml2-dev libncurses-dev libz3-dev pkg-config tzdata zlib1g-dev
# echo $?
1
Or when --post-install-file is used, the exit code is zero, and everything works out fine. There are even considerably less log lines on the console.
# swiftly install --use 6.0.2 --post-install-file postinstall.sh
Installing Swift 6.0.2
[...]
Swift 6.0.2 installed successfully!
root@147ea1585345:/# echo $?
0
Out of the two behaviors, I definitely prefer the init version of returning successfully, with some advisory messages on the console. Alternatively, it would be nice to have a --skip-post-install flag to completely skip the check1 in both commands.
What do you think?
Footnotes
I did not look into which package exactly is triggering the issue – but there's also nothing to do about it. On Heroku, installing extra packages with apt-get is not possible. It shouldn't be necessary in the first place, as the stack image contains everything that Swift apps usually need. ↩
The text was updated successfully, but these errors were encountered:
I've noticed that the
init
and theinstall
command behave differently when the tool decides that there are post-install commands to be executed.Consider the following (executed in an
ubuntu:24.04
container):In short, when the
init
command preinstalls the latest version, the post-install command is just an advice, but the command succeeded. This is good.However, if I am to install a different version with
swiftly install
, there are two possible outcomes.--post-install-file
parameter is not used, the command exits with status 1! That error exit code can, for example, break the build of the application on Heroku (ask me how I learned that).--post-install-file
is used, the exit code is zero, and everything works out fine. There are even considerably less log lines on the console.Out of the two behaviors, I definitely prefer the
init
version of returning successfully, with some advisory messages on the console. Alternatively, it would be nice to have a--skip-post-install
flag to completely skip the check1 in both commands.What do you think?
Footnotes
I did not look into which package exactly is triggering the issue – but there's also nothing to do about it. On Heroku, installing extra packages with apt-get is not possible. It shouldn't be necessary in the first place, as the stack image contains everything that Swift apps usually need. ↩
The text was updated successfully, but these errors were encountered: