Skip to content

Cannot create temp file for executing external commands over a range when shell is set to powershell #15913

@3N4N

Description

@3N4N

Neovim version (nvim -v)

NVIM v0.5.1

Vim (not Nvim) behaves the same?

Can't say. Do not have vim installed.

Operating system/version

Windows 10 21H1

Terminal name/version

Windows Terminal, Conhost

$TERM environment variable

Nil

Installation

Put the zip folder from release page and added the location in Windows path variable

How to reproduce the issue

nvim -u NONE
:let &shell = 'pwsh'
:let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
:let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
:let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
:set shellquote= shellxquote=
:e random-nonempty.file
:1,5!sort

Expected behavior

The lines from 1 to 5 should be sorted with the external sort command (which exists in my path).

Actual behavior

I get the following error.

E485: Can't read file C:\Users\ACER\AppData\Local\Temp\nvim6UJx04\7

I checked with Process Monitor and saw that neovim is failing to create the file/subdirectory ...\nvim6UJx04\7 when the :h 'shell' is set to pwsh (PowerShell Core). With shell set to cmd, it works alright. Note that in my full config, I set up the shell according to :h 'shell-powershell' but the same issue persists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions