mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-31 14:43:40 -05:00
fix(lib): doom/reload: on Windows
- cmd.exe chokes on the space in "C:\Program Files\...", but more importantly, doom.ps1 should be invoked with powershell, not cmd.exe. - Windows has pwsh.exe and powershell.exe, which, while not identical, are close enough for our purposes, but needed to be accounted for. Fix: #8098
This commit is contained in:
18
bin/doom.ps1
18
bin/doom.ps1
@@ -1,12 +1,19 @@
|
||||
# bin/doom.ps1
|
||||
# TODO: Use magic shebang (polyglot)?
|
||||
|
||||
if (!(Get-Command -Erroraction silentlycontinue emacs.exe)) {
|
||||
echo "Couldn't find emacs.exe in your PATH."
|
||||
exit 1
|
||||
function Executable-Find {
|
||||
foreach ($exe in $args) {
|
||||
if ($exe) {
|
||||
$path = Get-Command $exe -ErrorAction SilentlyContinue
|
||||
if ($path) { return $path.Path; }
|
||||
}
|
||||
}
|
||||
throw "Could not find in $PATH: $($args -join ', ')"
|
||||
}
|
||||
|
||||
$emacs = if ($env:EMACS) { $env:EMACS } else { Executable-Find "emacs.exe" }
|
||||
$pwsh = Executable-Find "pwsh.exe" "powershell.exe"
|
||||
$doom = "$PSScriptRoot/doom"
|
||||
$emacs = if ($env:EMACS) { $env:EMACS } else { (Get-Command emacs.exe).Path }
|
||||
$oldemacsdir = $env:EMACSDIR
|
||||
|
||||
try {
|
||||
@@ -24,7 +31,8 @@ try {
|
||||
|
||||
& $emacs -q --no-site-file --batch --load "$doom" -- --no-color $args
|
||||
if ($LASTEXITCODE -eq 254) {
|
||||
& pwsh "$($env:temp)\doom.$($env:__DOOMPID).$($env:__DOOMSTEP).ps1" $PSCommandPath $args
|
||||
# TODO: Use Invoke-Command instead?
|
||||
& $pwsh "$($env:temp)\doom.$($env:__DOOMPID).$($env:__DOOMSTEP).ps1" $PSCommandPath $args
|
||||
$exit = $LASTEXITCODE
|
||||
}
|
||||
exit $exit
|
||||
|
Reference in New Issue
Block a user