antonmedv / walk

Terminal file manager
MIT License
3.24k stars 88 forks source link

"failed to get console mode for stdout" in windows powershell #30

Closed zch-lusa closed 1 year ago

zch-lusa commented 1 year ago

image

I get this error message on windows powershell.

What i did:

Expected behavior: Setting Location to my selected location Actual Behavior: Error above

Any idea where this is from?

antonmedv commented 1 year ago

Looks like powershell script should be little bit different. Does anyone know?

samg7b5 commented 1 year ago

The powershell script in your README is fine in the sense that executing my_ll <path> defined below works as expected:

function my_ll() {
  cd "$(echo $args)"
}

So it's a problem with llama returning an error instead of path. Possibly this line is erroring https://github.com/antonmedv/llama/blob/master/main.go#L76 output := termenv.NewOutput(os.Stderr). Seems strange to have not tested it.

zch-lusa commented 1 year ago

As an addition when i call llama.exe "manually" and then exit with esc, the outputting of the path works. Somehow the script seems to not find the correct handle to put the output to in the powershell-script case:

image

mike-ward commented 1 year ago

I'm seeing the same thing here.

image

mike-ward commented 1 year ago

Also, could the PowerShell command be simplified to

llama | cd

It seems to work, even with the error messages.

antonmedv commented 1 year ago

Looks like the problem is in upstream dependency: https://github.com/charmbracelet/gum/issues/32

zch-lusa commented 1 year ago

@mike-ward: For me this just prints the error message at the time I execute ll. After that it works with the cd but just looks not nice as the folders are kind of "over" the error message.

TheReptar commented 1 year ago

@mike-ward I also received undesirable results with the llama | cd approach, unfortunately.

@zch-lusa I was able to put together a simple workaround that seemed to behave as expected during my testing; you can modify your powershell script to the following:

function ll() {
  cd $(llama $args | Out-String -Stream)[-1]
}

This is by no means a perfect solution as this will ignore the error message altogether by splitting the llama output by line and simply grabbing the last line (which for me was always the desired path), but this should at least get you rolling until a better long-term solution is put together.

RND332 commented 1 year ago

@mike-ward I also received undesirable results with the llama | cd approach, unfortunately.

@zch-lusa I was able to put together a simple workaround that seemed to behave as expected during my testing; you can modify your powershell script to the following:

function ll() {
  cd $(llama $args | Out-String -Stream)[-1]
}

This is by no means a perfect solution as this will ignore the error message altogether by splitting the llama output by line and simply grabbing the last line (which for me was always the desired path), but this should at least get you rolling until a better long-term solution is put together.

It helps, Windows 11 powershell, if it's a dependency-level error, can add it to the README until it's fixed? Better not an ideal solution than non-working ones

RND332 commented 1 year ago

@zch-lusa can i ask what version of powershell are you use?

It seems that powershell 5.1, crookedly shows errors after using llama, on powershell 7 at myself and in your screenshots, I don't see this. Maybe it makes sense to open an Issue, or just mention it in the README

LucaSalzani commented 1 year ago

Name Value


PSVersion 7.3.0 PSEdition Core GitCommitId 7.3.0 OS Microsoft Windows 10.0.22000 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Seems to be ps 7

edit: whoops different account :) i am zch-lusa

antonmedv commented 1 year ago

Should be fixed.