view more/ @ 1432:ee0e4f2f4bdb

Fiddle with the downloads/binaries layout yet again, and update README for it.
author Rob Landley <>
date Tue, 23 Aug 2011 08:21:48 -0500
parents 2868f2d87624
line wrap: on
line source


# Run a command line with a hang timeout, which kills the child process if it
# doesn't produce a new line of output for $1 seconds.

# This script has to be a separate process (rather than just a shell function)
# so killing it doesn't kill the parent process.

source sources/

if [ $# -lt 1 ]
  echo "Usage: SECONDS COMMANDS..." >&2
  exit 1

trap "killtree $$" EXIT
( eval "$@" ) | tee >(while read -t "$TIMEOUT" -n 32 i; do true; done; sleep 1; kill -TERM $$ 2>/dev/null )