refactor(cli): bin/doomscript: simplify redirs, update commment
This commit is contained in:
parent
04057003c2
commit
a61e2912cf
1 changed files with 13 additions and 13 deletions
|
@ -36,25 +36,25 @@ emacs="$EMACS -q --no-site-file --batch"
|
||||||
# on it to provide TMPDIR. And can second as a quick existence check for Emacs.
|
# on it to provide TMPDIR. And can second as a quick existence check for Emacs.
|
||||||
TMPDIR="${TMPDIR:-$($emacs --eval '(princ (temporary-file-directory))' 2>/dev/null)}"
|
TMPDIR="${TMPDIR:-$($emacs --eval '(princ (temporary-file-directory))' 2>/dev/null)}"
|
||||||
if [ -z "$TMPDIR" ]; then
|
if [ -z "$TMPDIR" ]; then
|
||||||
>&2 echo "Error: failed to run Emacs with command '$EMACS'"
|
echo "Error: failed to run Emacs with command '$EMACS'"
|
||||||
>&2 echo
|
echo
|
||||||
>&2 echo "Are you sure Emacs is installed and in your \$PATH?"
|
echo "Are you sure Emacs is installed and in your \$PATH?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi >&2
|
||||||
|
|
||||||
# Doom respects $EMACSDIR to tell it where Doom lives. If it fails, then this is
|
# Doom respects $EMACSDIR to tell it where Doom lives. If it fails, then this is
|
||||||
# either isn't bash, or it's a posix shell being directly sourced with sh, which
|
# either isn't bash, or it's a posix shell being directly sourced with sh, which
|
||||||
# is unsupported.
|
# is unsupported.
|
||||||
export EMACSDIR="${EMACSDIR:-$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE:-$0}")/.." && pwd)}"
|
export EMACSDIR="${EMACSDIR:-$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE:-$0}")/.." && pwd)}"
|
||||||
if [ ! -f "$EMACSDIR/early-init.el" ]; then
|
if [ ! -f "$EMACSDIR/early-init.el" ]; then
|
||||||
>&2 echo "Error: cannot load $EMACSDIR/early-init.el."
|
echo "Error: cannot load $EMACSDIR/early-init.el."
|
||||||
>&2 echo
|
echo
|
||||||
>&2 echo "Either the file doesn't exist (indicating a broken or missing Doom install)"
|
echo "Either the file doesn't exist (indicating a broken or missing Doom install)"
|
||||||
>&2 echo "or that doomscript is being source directly (which is unsupported)."
|
echo "or that doomscript is being source directly (which is unsupported)."
|
||||||
>&2 echo
|
echo
|
||||||
>&2 echo "Set \$EMACSDIR to the path of an existing Doom installation."
|
echo "Set \$EMACSDIR to the path of an existing Doom installation."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi >&2
|
||||||
# Some state that Doom's CLI framework needs to know about the terminal. Read
|
# Some state that Doom's CLI framework needs to know about the terminal. Read
|
||||||
# the comments at the top of bin/doom for explanations.
|
# the comments at the top of bin/doom for explanations.
|
||||||
export __DOOMPID="${__DOOMPID:-$$}"
|
export __DOOMPID="${__DOOMPID:-$$}"
|
||||||
|
@ -75,8 +75,8 @@ $emacs --load "$EMACSDIR/early-init" \
|
||||||
-- "$@"
|
-- "$@"
|
||||||
exit=$?
|
exit=$?
|
||||||
|
|
||||||
# To simulate execve syscalls, Doom generates a temporary exit-script if a
|
# To simulate execve syscalls (which replaces the running process), Doom
|
||||||
# Doomscript returns a 254 exit code.
|
# generates a temporary exit-script if a Doomscript returns a 254 exit code.
|
||||||
if [ "${exit:-0}" -eq 254 ]; then
|
if [ "${exit:-0}" -eq 254 ]; then
|
||||||
# The user may have a noexec flag set on /tmp, so the exit-script should be
|
# The user may have a noexec flag set on /tmp, so the exit-script should be
|
||||||
# passed to /bin/sh rather than executed directly.
|
# passed to /bin/sh rather than executed directly.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue