Greg Troxel <
g...@lexort.com> writes:
> and when wedged, ps shows
>
> gdt 2561 0.0 0.0 23988 2316 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
> gdt 2675 0.0 0.0 17720 1240 pts/4 I+ 6:16PM 0:00.04 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
> gdt 13075 0.0 0.0 17652 1396 pts/4 I+ 6:16PM 0:00.00 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
> gdt 15019 0.0 0.0 18488 1920 pts/4 I+ 6:16PM 0:00.03 wc -l
> gdt 20171 0.0 0.0 23988 2336 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
> gdt 21929 0.0 0.0 23776 3232 pts/4 I+ 6:16PM 0:00.00 bash /home/gdt/SOFTWARE/BUP/bup/dev/with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest
Does "script -qec bup ls -l SOMETHING/latest /dev/null" work if you run
it directly for some repository/branch?
> On NetBSD 10, "script -qec true /dev/null" exits with 0.
Right, seems like it should from the manpage:
https://man.netbsd.org/script.1
(looks like linux and netbsd have compatible options there).
> I am unclear on if the quoting here is right, or what the intent is:
>
> script -qec "$(printf ' %q' "$@")" /dev/null
That's just intending to make sure we properly escape the requested
command before passing it through -c (e.g. for arguments with spaces
etc.).
Bash's printf %q handles the quoting, and printf automatically repeats
the formatting to consume all of its arguments. So it turns
printf ' %q' 'a b' 'c d'
into
a\ b c\ d
> I'll try main, too.
I had also started augmenting with-tty a bit back. So far, here, I have:
#!/usr/bin/env bash
set -ueo pipefail
# Callers can test for support via "with-tty true".
usage() { echo 'Usage: with-tty command [arg ...]'; }
misuse() { usage 1>&2; exit 2; }
if script -qec true /dev/null; then
script -qec "$(printf ' %q' "$@")" /dev/null
elif script -q /dev/null true; then
script -q /dev/null "$@"
else
rc=0
cmd="$(command -v script)" || rc=$?
if test "$rc" -eq 0; then
printf 'Unsupported script command: %q\n' "$cmd" 1>&2
else
echo 'No script command' 1>&2
fi
exit 2
fi
But I don't think that'll affect whatever problem you're encountering.
--
Rob Browning
rlb @
defaultvalue.org and @
debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4