Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

PowerShell integration breaks existing PSConsoleHostReadline

Offen
#190 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

@markovejnovic arbeitet bereits daran.

Seit 27.10.2026.

  • #194 von @markovejnovic — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
powershell, rust
Bereich
cli

Rechercherichtung

Start with src/pwsh-install-template.ps1, especially the PSConsoleHostReadLine definition linked in the issue, and review how it reads and rewrites commands. Reproduce the conflict with Atuin or another existing readline handler in a PowerShell session. Done when the previous handler is called and command history records the faithful command while coreutils commands still work.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hey! I'm an engineer at Atuin and a user filed a report describing that Atuin doesn't appear to be compatible with this project at https://github.com/atuinsh/atuin/issues/4386. Atuin is a program that records your shell command history.

It seems that the user's issue is because you override PSConsoleHostReadline in https://github.com/microsoft/coreutils/blob/8a56d6fc1e5a36116c245781cb3758ebe758bb9a/src/pwsh-install-template.ps1#L80.

We also override PSConsoleHostReadline, and since coreutils is defined last, coreutils' implementation of PSConsoleHostReadline wins, which prevents ours from being called.

I had the idea of calling your PSConsoleHostReadline in Atuin's PS1 files and then passing that down our handler:

if (!$script:__ATUIN_PREV_READLINE__) {
    $script:__ATUIN_PREV_READLINE__ = $Function:PSConsoleHostReadLine
}

function PSConsoleHostReadLine {
    $line = & $script:__ATUIN_PREV_READLINE__
    # ...

But that unfortunately doesn't capture history accurately since you use PSConsoleHostReadline to rewrite the command:

ls        -> & 'C:\Program Files\coreutils\cmd\ls.cmd' --color=auto
ls -la    -> & 'C:\Program Files\coreutils\cmd\ls.cmd' --color=auto -la

I'd suspect that atuin is perhaps not the only program which overrides PSConsoleHostReadline. I'd appreciate if you implemented the fix I attempted to implement in Atuin. I think it's relatively reasonable for you to assume that the result of PSConsoleHostReadline from any other programs will be a "faithful" command you can straight up run. Something like this:

+if (!$script:__COREUTILS_PREV_READLINE__) {
+    $script:__COREUTILS_PREV_READLINE__ = $Function:PSConsoleHostReadLine
+}
 function PSConsoleHostReadLine {
     [System.Diagnostics.DebuggerHidden()]
     param()

-    $lastRunStatus = $?
+    # Must stay the first statement: the previous handler reads $? itself.
+    $line = & $script:__COREUTILS_PREV_READLINE__
     Microsoft.PowerShell.Core\Set-StrictMode -Off
-    $line = [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace, $ExecutionContext, $lastRunStatus)

I'm setting up a Windows VM and I'll open a PR when I have that ready.

Vorherrschende Sprache
Rust
Sterne
5.3k
Forks
110
Ø Merge
1 Std. 26 Min.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/coreutils

Alle Issues in microsoft/coreutils

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.