Running gsutil command breaks -EditMode Emacs for the rest of the session.
Closed this issue · 13 comments
Environment
PS version: 6.2.1
PSReadline version: 2.1.0
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 6.2.1.0
HostName: ConsoleHost
BufferWidth: 172
BufferHeight: 9001
Steps to reproduce
I am using Set-PSReadLineOption -EditMode Emacs
. When I run a gsutil command, for example gsutil ls
, Emacs mode is at least partially broken.
Specifically, "ctrl+a" reverts to being select-all rather than "go to beginning of line." I don't think auth is required to trigger the issue, I get it just after doing this:
> gsutil ls
You are attempting to perform an operation that requires a project id, with none configured. Please re-run gsutil config and make sure to follow the instructions for finding and entering your default project id.
ctrl+a is broken until I close the powershell window. I assume gsutil is sending some sort of control character? I'm not sure what the simplest way to do a binary analysis of what it's outputting is.
Hi @lukeschlather are you still facing this problem in the latest versions of PSReadLine and gsutil
?
This issue is closed because it has been marked as requiring author feedback but has not had any activity for 7 days. If you think the issue is still relevant, please reopen and provide your feedback.
It's still happening with PSReadline 2.2.6 and gsutil 5.21. In fact just running gsutil version triggers the issue.
@lukeschlather are you running the latest version of PowerShell (7.3)?
Yes.
Hmm alt+a
seem to work correctly for me given your repro steps in the latest beta release of PSReadLine (2.3.1-beta1). Give that a try. Let me know if you are still coming across this issue and we can dig in further
> Get-Module PSReadLine
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.3.1 beta1 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption…
> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I should say this is all the relevant stuff in my profile:
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineKeyHandler -Key 'Ctrl+V' -Function Paste
Set-PSReadLineKeyHandler -Key 'Ctrl+v' -Function Paste
Set-PSReadLineKeyHandler -Key 'Ctrl+/' -Function Undo
Set-PSReadLineKeyHandler -Key 'Ctrl+Backspace' -Function BackwardKillWord
Set-PSReadLineKeyHandler -Key 'Ctrl+LeftArrow' -Function BackwardWord
Set-PSReadLineKeyHandler -Key 'Ctrl+RightArrow' -Function ForwardWord
Set-PSReadLineOption -AddToHistoryHandler $null
Set-PSReadlineOption -BellStyle None
}
@lukeschlather I cannot reproduce the issue on Windows. From my screen GIF below, you can see that I press Ctrl+a
, and the cursor goes to beginning of line as expected.
I'm using 2.3.1-beta1 version of PSReadLine with PSv7.2.11 on Windows 11. gsutil version
returns 5.23
. I started a fresh pwsh session without profile, and then ran the relevant command in your previous comment to mimic your session.
Can you please provide detailed repro steps to help us reproduce the issue locally?
I can reproduce this on two different Windows laptops running Windows 10 Pro. I ran pwsh -noprofile from a cmd prompt and followed your steps and I can repro the issue.
I launched a Windows Server 2022 datacenter edition image in Google Cloud:
https://console.cloud.google.com/compute/imagesDetail/projects/windows-cloud/global/images/windows-server-2022-dc-v20230414
launched powershell
Install-Module -Name PSReadline -Force -RequiredVersion 2.3.1-beta1 -AllowPrerelease
launched a cmd / pwsh -noprofile, did
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Emacs
ctrl-a works normally.
Run gsutil with no args, ctrl-a does select all.
I created fresh Azure VMs for Windows 10 Pro (Version 22H2, OS Build 10.0.19045.2965
) and Windows Server 2022 (Version 21H2, OS Build 10.0.20348.1726
), and used the exact steps as described in your last comment, but I still cannot reproduce the issue.
Below are the GIFs showing my steps on both VMs. Ctrl+a
works as expected -- cursor goes to the beginning of line -- after running gsutil
:
Windows 10 Pro
Windows Server 2022
I suspect this is very specific to the system environment you are using, maybe another software playing a role in combination with gsutil
that together causes the console/terminal to work differently. Anyway, I really cannot reproduce the reported issue.
I can't repro on an Azure VM with the same specs as you either ( Windows 10 Pro / 22H2 / OS Build 19045.2965 )
However my local laptop with the same OS version reproduces the issue, as does a stock GCP VM running the Google image, which has Windows Server 2022 Datacenter / 21H2 / OS Build 20348.1668 .
I compared Google SDK versions and my laptop still reproduces the issue after being updated to the latest version of the gcloud sdk ( 430.0.0 ). I compared the components installed with gcloud components list and I don't see any differences there either.
However my local laptop with the same OS version reproduces the issue, as does a stock GCP VM running the Google image, which has Windows Server 2022 Datacenter / 21H2 / OS Build 20348.1668 .
That's why I was suspecting maybe something else is playing a role in combination with gsutil
for the terminal/console to behave differently. And I cannot reproduce it on my local Windows 11 machine as well (#1970 (comment)).