https://blue-build.org/ logo
Script module not outputing stdout on failure
# questions
l
I have a script like this
Copy code
sh
#!/bin/sh
set -euxo pipefail
set -a
. /usr/lib/environment.d/desktop-env.conf
set +a
echo "STDOUT HERE" 
>&2 echo "STDERR HERE"
export XDG_RUNTIME_DIR=/tmp
exec Hyprland --verify-config --i-am-really-stupid
echo "STDOUT AFTER"
exit 1
(I added the echos while debugging) When building it fails like this
Copy code
l/leloublue:latest => #59 0.123 ============================ Start 'script' Module ============================
l/leloublue:latest => #59 0.168 Running snippet:
l/leloublue:latest => #59 0.168 /usr/share/desktop-config/check.sh
l/leloublue:latest => #59 0.170 + set -a
l/leloublue:latest => #59 0.170 + . /usr/lib/environment.d/desktop-env.conf
l/leloublue:latest => #59 0.170 + set +a
l/leloublue:latest => #59 0.170 + echo 'STDOUT HERE'
l/leloublue:latest => #59 0.170 + echo 'STDERR HERE'
l/leloublue:latest => #59 0.170 STDERR HERE
l/leloublue:latest => #59 0.170 + export XDG_RUNTIME_DIR=/tmp
l/leloublue:latest => #59 0.170 + XDG_RUNTIME_DIR=/tmp
l/leloublue:latest => #59 0.170 + exec Hyprland --verify-config --i-am-really-stupid
l/leloublue:latest => #59 0.265 Error: nu::shell::eval_block_with_input
The output is too long for a single message, but right after this it fails with × External command had a non-zero exit code So I am pretty sure the Hyprland command is failing. But I don't get any stdout output in order to actually debug it, did I miss something ?
a
message has been deleted
f
you need to do it like this
Copy code
sh
if ! exec Hyprland --verify-config --i-am-really-stupid; then
  echo "STDOUT AFTER"
  exit 1
fi
You overwrite it on top of this
Copy code
sh
exec Hyprland --verify-config --i-am-really-stupid
echo "STDOUT AFTER"
exit 1
This is just how the shell
-e
option works
l
no I dont mean the stdout after part
I know why I'm not getting it (and I should not get it if exec worked at all)
but I ALSO dont get the "STDOUT HERE" message
which is before
And I also don't get the output of Hyprland --verify-config --i-am-really-stupid
which gets printed on stdout
Sorry I should have been clearer
f
hmm, I see
maybe some shell bug
2 Views