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

Added optional logging of startx output #30

Merged
merged 1 commit into from Mar 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cdm
Expand Up @@ -78,6 +78,7 @@ locktty=${locktty:-no}
consolekit=${consolekit:-yes}
cktimeout=${cktimeout:-30}
altstartx=${altstartx:-no}
startxlog="${startxlog:-/dev/null}"
[[ -z "${binlist[*]}" ]] && binlist=()
[[ -z "${namelist[*]}" ]] && namelist=()
[[ -z "${flaglist[*]}" ]] && flaglist=()
Expand Down Expand Up @@ -201,6 +202,7 @@ case ${flaglist[$binindex]} in

$(yesno consolekit) && launchflags=(-c -t "$cktimeout")
$(yesno altstartx) && launchflags=("${launchflags[@]}" --altstartx)
launchflags=("${launchflags[@]}" --startxlog "$startxlog")
if cdm-xlaunch "${launchflags[@]}" -- "${bin[@]}" -- "${serverargs[@]}"
then
exitnormal
Expand Down
11 changes: 8 additions & 3 deletions src/cdm-xlaunch
Expand Up @@ -32,11 +32,12 @@ name=$(basename "$0")
consolekit=false
cktimeout=30
altstartx=false
startxlog=/dev/null

info() { printf ' \033[01;32m*\033[00m '; echo "$name: $*"; }
error() { (printf ' \033[01;31m*\033[00m '; echo "$name: $*") > /dev/stderr; }

args=$(getopt -n "$name" -o ct: -l consolekit,timeout,altstartx: -- "$@") || exit 1
args=$(getopt -n "$name" -o ct: -l consolekit,timeout:,altstartx,startxlog: -- "$@") || exit 1
eval set -- "$args"
for arg in "$@"
do
Expand All @@ -51,6 +52,10 @@ do
'--altstartx')
altstartx=true; shift
;;
'--startxlog')
shift
startxlog=$1; shift
;;
'--')
shift
break
Expand Down Expand Up @@ -82,9 +87,9 @@ fi

if $altstartx; then
# Alternative method of calling setsid(/startx) for systems that are unresponsive to the 'normal' call.
(setsid startx "$@" > /dev/null 2>&1 &)
(setsid startx "$@" > "$startxlog" 2>&1 &)
else
setsid startx "$@" > /dev/null 2>&1 &
setsid startx "$@" > "$startxlog" 2>&1 &
fi

# If wait(1) returns with a value >128, it was interrupted by kill(1),
Expand Down
3 changes: 3 additions & 0 deletions src/cdmrc
Expand Up @@ -62,3 +62,6 @@ serverargs=(-nolisten tcp)
# no apparent reason does not start X).
# Only provided in the hope it may be useful, not a guaranteed fix.
altstartx=no

# Destination for stdout and stderr output from startx.
startxlog=/dev/null