From 18a7244ee5d47b083bc3653a8d97ac6ef8bad5bc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 25 Oct 2013 15:46:42 -0400 Subject: librechroot+indent: Add in a bunch of extra '\r's to work-around the systemd bug --- src/chroot-tools/librechroot | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/chroot-tools/librechroot') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 4941b95..65977ea 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -178,10 +178,22 @@ arch_nspawn_flags=() sysd_nspawn_flags=() arch-nspawn() { local copydir=$1; shift + # XXX: SYSTEMD-STDOUT HACK if [[ -t 1 ]]; then cmd=("$@") else - cmd=(bash --noprofile --norc -c "set -o pipefail; $(printf '%q ' "$@") |&cat") + # This perl script is equivalent to `sed -s 's|\n|\r\n|g', but + # it doesn't line-buffer. + local perlcmd=' +my $size; +my $buffer; +while(1) { + $size=sysread(STDIN, $buffer, 40); + last if ($size < 1); + $buffer =~ s/\n/\r\n/g; + syswrite(STDOUT, $buffer); +}' + cmd=(bash --noprofile --norc -c "set -o pipefail; $(printf '%q ' "$@") |& perl -e $(printf '%q' "$perlcmd")") fi set +u # if an array is empty, it counts as unbound -- cgit v1.2.3-2-g168b