Mercurial > hg > aboriginal
annotate sources/timeout.sh @ 962:3d2261361009
Remove the --extract option from download.sh, since EXTRACT_ALL=1 does the same thing and everything _else_ is controlled by environment variables. At it to the config file and adjust existing users.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 01 Feb 2010 03:46:49 -0600 |
parents | 2ca7ea5d3ec1 |
children |
rev | line source |
---|---|
843
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Run a command line with a hang timeout, which kills the child process if it |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # doesn't produce a new line of output for $1 seconds. |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 # This script has to be a separate process (rather than just a shell function) |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 # so killing it doesn't kill the parent process. |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 source sources/functions.sh |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 if [ $# -lt 1 ] |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 then |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 echo "Need timeout value" >&2 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 exit 1 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 fi |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 trap "killtree $$" EXIT |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 TIMEOUT="$1" |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 shift |
2ca7ea5d3ec1
New native-static-build.sh to compile static dropbear, strace, and busybox inside the emulator and export 'em out via ftp.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 ( "$@" ) | tee >(while read -t "$TIMEOUT" -n 32 i; do true; done; sleep 1; kill -TERM $$ 2>/dev/null ) |