Skip to content

Commit 2a438c3

Browse files
committed
Fix tue-install-pipe; does require echo of stdout for pipe
1 parent cfee808 commit 2a438c3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/tue_get/installer_impl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def _write_stdin(msg) -> None:
159159
_write_stdin(0)
160160
elif line.startswith("tue-install-pipe: "):
161161
output = line[18:].split("^^^")
162+
output = map(lambda x: x.replace("^", "\n").strip(), output)
162163
self.tue_install_pipe(*output)
163164
_write_stdin(0)
164165
elif line.startswith("tue-install-target-now: "):
@@ -287,8 +288,10 @@ def tue_install_pipe(self, stdout: str, stderr: str) -> None:
287288
:param stderr:
288289
:return:
289290
"""
290-
self.tue_install_tee(stdout)
291-
self.tue_install_tee(stderr, color="red")
291+
if stdout:
292+
self.tue_install_tee(stdout)
293+
if stderr:
294+
self.tue_install_tee(stderr, color="red")
292295

293296
def tue_install_target_now(self, target: str) -> bool:
294297
self.tue_install_debug(f"tue-install-target-now {target=}")

src/tue_get/resources/installer_impl.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function tue-install-warning
1313
echo -e "tue-install-warning: $*"
1414
local return_value
1515
read -r return_value
16-
echo -e "return_value: ${return_value}"
1716
return $(("$return_value"))
1817
}
1918

@@ -27,7 +26,7 @@ function tue-install-info
2726

2827
function tue-install-debug
2928
{
30-
echo -e "tue-install-info: $*"
29+
echo -e "tue-install-debug: $*"
3130
local return_value
3231
read -r return_value
3332
return $(("$return_value"))
@@ -51,6 +50,7 @@ function tue-install-tee
5150

5251
function tue-install-pipe
5352
{
53+
local return_code
5454
local pipefail_old return_code
5555
pipefail_old=$(set -o | grep pipefail | awk '{printf $2}')
5656
[ "$pipefail_old" != "on" ] && set -o pipefail # set pipefail if not yet set
@@ -62,13 +62,19 @@ function tue-install-pipe
6262
} < <((printf '\0%s\0' "$("$@")" 1>&2) 2>&1)
6363
return_code=$?
6464
[ "$pipefail_old" != "on" ] && set +o pipefail # restore old pipefail setting
65+
# shellcheck disable=SC2034
66+
TUE_INSTALL_PIPE_STDOUT=$CAPTURED_STDOUT
67+
68+
CAPTURED_STDOUT=$(echo -e "$CAPTURED_STDOUT" | tr '\n' '^')
69+
CAPTURED_STDERR=$(echo -e "$CAPTURED_STDERR" | tr '\n' '^')
6570
echo -e "tue-install-pipe: ${CAPTURED_STDOUT}^^^${CAPTURED_STDERR}"
6671
read -r return_value
6772
if [ "$return_value" != "0" ]
6873
then
74+
tue-install-echo "return_value: $return_value"
6975
return $(("$return_value"))
7076
fi
71-
77+
tue-install-echo "return_code: $return_code"
7278
return $return_code
7379
}
7480

0 commit comments

Comments
 (0)