Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Close the console FD on upgrade #500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions packaging/common/script-templates/script-common-header-last.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,12 @@ is_nova()
test "$PROJECT_TYPE" = "cfengine-nova" || test "$PROJECT_TYPE" = "cfengine-nova-hub"
}

INSTLOG=/var/log/CFEngineHub-Install.log
mkdir -p "$(dirname "$INSTLOG")"
CONSOLE=7
# Redirect most output to log file, but keep console around for custom output.
case "$SCRIPT_TYPE" in
pre*)
eval "exec $CONSOLE>&1 > $INSTLOG 2>&1"
;;
*)
eval "exec $CONSOLE>&1 >> $INSTLOG 2>&1"
;;
esac
echo "$SCRIPT_TYPE:"

# Output directly to console, bypassing log.
cf_console()
{
# Use subshell to prevent "set +x" from leaking out into the rest of the
# execution.
(
set +x
"$@" 1>&$CONSOLE 2>&$CONSOLE
)
"$@"
}

set -x