Skip to content

[nvim] Changing shell options on windows breaks AsyncRun #281

@mynamedjef

Description

@mynamedjef

Using this minimal setup and neovim:

filetype plugin indent on
filetype plugin on

call plug#begin()
Plug 'skywind3000/asyncrun.vim'
call plug#end()

let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
let &shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote= shellxquote=

When I run :AsyncRun, I get something like this (python x.py should just output 'ok'):

|| [python x.py]
|| C:\Users\User\AppData\Local\Temp\nvim.0\7bpwQs\asyncrun.cmd
|| [Finished in 1 seconds]

Taking a look at asyncrun.cmd:

@echo off
call %VIM_COMMAND% 
set VIM_EXITCODE=%ERRORLEVEL%
call %VIM_PAUSE% 
exit %VIM_EXITCODE%

Removing shell commands (from let &shell to set shellquote), makes AsyncRun work correctly.
My logic is that powershell doesn't invoke asyncrun.cmd correctly. Is there a fix for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions