Sha256: b498d6a497ed9282671fb813afc8f238548d364a88a1de2489428fdf11263b2c
Contents?: true
Size: 841 Bytes
Versions: 9
Compression:
Stored size: 841 Bytes
Contents
#!/bin/sh IFS= pid=$$ tmpdir=$1 streams=$2 cmd=$3 if [[ !( "$cmd" ) || !( "$streams" ) ]]; then echo "A valid command or set of streams were not provided." exit 1 fi if [[ ( $tmpdir ) && ( -d "$tmpdir" ) && ( -w "$tmpdir" ) ]]; then stdin="&0" stdout="&1" stderr="&2" IFS="," for streamname in $streams; do export "$streamname"="$tmpdir/$pid.$streamname.pipe" mkfifo -m 600 "$tmpdir/$pid.$streamname.pipe" exit=$? test $exit -gt 0 && exit $exit done IFS= shift && shift && shift eval "exec 2>$stderr" eval "exec 3<$stdin" eval "exec 1>$stdout" $cmd $* <&3 status=$? IFS="," for streamname in $streams; do rm "$tmpdir/$pid.$streamname.pipe" done IFS= exit $status else echo "Temporary directory \"$tmpdir\" doesn't exist or is not writable." exit 1 fi
Version data entries
9 entries across 9 versions & 1 rubygems