Mercurial > hgrepos > hgweb.cgi > s4
changeset 531:01b9e2b16d7a
Redirect stderr to file only if being called via CGI
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 06 Apr 2019 18:26:33 +0900 |
parents | b9d80980b7b4 |
children | c4597d0873e6 |
files | s4-funcs.sh |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Sat Apr 06 18:20:21 2019 +0900 +++ b/s4-funcs.sh Sat Apr 06 18:26:33 2019 +0900 @@ -7,6 +7,7 @@ myname=`basename ${SCRIPT_NAME:-$0}` mydir=`dirname ${SCRIPT_FILENAME:-$0}` myargs="$@" +test -n "$HTTP_HOST" && isCGI=true PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH tmpdir=${TMPDIR:-tmp} dbdir=${DBDIR:-db} @@ -346,9 +347,11 @@ #tail -f $sqi | sq $db & # "tail -f" is too heavy. DO NOT USE!! sq $db < $sqi & sq3pid="`jobs -p` $!" - exec 2>> $tmpdir/error.out + if [ -z "$isCGI" ]; + exec 2>> $tmpdir/error.out + fi exec 3>> $tmpdir/debug.out - exec 5> $sqi # Turning $sqi access through fd5 for continuous open state + exec 5> $sqi # Turning $sqi access through fd5 for continuous open state rm $sqi } cleanup2() { # Dirty workaround for produced zombie processes