Skip to content

Commit aef2038

Browse files
authored
Merge pull request #101 from IntersectMBO/fix_background_start
fix(logging): unify stderr and stdout handling in helpers
2 parents 3a5e72a + 6370bce commit aef2038

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/cardonnay/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def run_detached_command(
145145
cmd,
146146
cwd=pl.Path(workdir) if workdir else None,
147147
stdout=logout,
148-
stderr=logout,
148+
stderr=subprocess.STDOUT,
149149
stdin=subprocess.DEVNULL,
150150
close_fds=True,
151151
start_new_session=True,

src/cardonnay_scripts/scripts/common/common.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,13 @@ get_slot_length() {
2929
}
3030

3131
cardano_cli_log() {
32-
local stderr retval _
33-
3432
if [ -z "${START_CLUSTER_LOG:-}" ]; then
3533
START_CLUSTER_LOG="${STATE_CLUSTER}/start-cluster.log"
3634
fi
3735

3836
echo cardano-cli "$@" >> "$START_CLUSTER_LOG"
39-
40-
for _ in {1..3}; do
41-
retval=0
42-
# Capture stderr while also outputting both stdout and stderr to their original destinations
43-
{ stderr="$(cardano-cli "$@" 2> >(tee /dev/stderr) 1>&3)"; } 3>&1 || retval="$?"
44-
45-
case "$stderr" in
46-
*"resource vanished"*)
47-
printf "Retrying \`cardano-cli %s\`. Failure:\n%s\n" "$*" "$stderr" >&2
48-
sleep 1
49-
;;
50-
*)
51-
break
52-
;;
53-
esac
54-
done
55-
56-
return "$retval"
37+
cardano-cli "$@"
38+
return "$?"
5739
}
5840

5941
check_spend_success() {

0 commit comments

Comments
 (0)