Skip to content

Commit

Permalink
allow execution of files not in path
Browse files Browse the repository at this point in the history
Previously, if the file you wanted to nvidia-xrun was not in your path
and/or there were spaces in the filename, nvidia-xrun would fail.
  • Loading branch information
Charles Hall authored and Witko committed Dec 8, 2017
1 parent 9d23d00 commit 21c146d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nvidia-xinitrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ if [ -f "$userxinitrc" ]; then
sh ${userxinitrc} $#
else
if [ $# -gt 0 ]; then
$*
"$*"
fi
fi
14 changes: 10 additions & 4 deletions nvidia-xrun
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ NEWDISP=":$XNUM"

if [ ! -z "$*" ] # generate exec line if arguments are given
then
# test if executable exists
if [ ! -x "$(which $1 2> /dev/null)" ]
# test if executable exists in path
if [ -x "$(which $1 2> /dev/null)" ]
then
# generate exec line
EXECL="$(which $1)"
# test if executable exists on disk
elif [ -e "$(realpath "$1")" ]
then
# generate exec line
EXECL="$(realpath "$1")"
else
echo "$1: No such executable!"
exit 1
fi
# generate exec line
EXECL="$(which $1)"
shift 1
EXECL="$EXECL $*"
else # prepare to start new X sessions if no arguments passed
Expand Down

0 comments on commit 21c146d

Please sign in to comment.