This killed the script prematurely (without displaying the error) if
Emacs failed to execute. In versions prior to bash 4, set -e would not
terminate the script if a non-zero exit code occurred within a subshell,
but it will in bash 4+.
In any case, we don't need this fallback to begin with. The script
handles its errors sufficiently otherwise.
I had missed the fact that -Q implies not only
--no-site-file (intended), but --no-site-lisp (unintended). Without the
latter, no site-lisp directory is left in load-path, and any attempt to
load it after-the-fact (which I do in core-cli.el) will fail. Thanks to
@yamanq for noticing this!
Fix: #6473Fix: #4198
Co-authored-by: Yaman Qalieh <yamanq@users.noreply.github.com>
If no EMACSDIR is given, assume ../ is the Emacs config we want to
operate out of, taking after bin/doom.
And use bash. This script was designed for the convenience of other
scripters on unix systems, so it can afford a small hit to portability.
Meant as a simple elisp interpreter with Doom's CLI framework preloaded.
Can be used as a shebang line:
#!/usr/bin/env doomscript
(princ "hello world!")
This isn't used for bin/doom because it requires doomscript be in your
$PATH, and any attempt to resolve its location in bin/doom's shebang
line would reduce its portability. Neither of these should be an issue
for the type of user who'd find this useful.