Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Cannot run in nushell #561

Closed
shouyierban opened this issue Nov 5, 2024 · 8 comments · Fixed by #564
Closed

[Windows] Cannot run in nushell #561

shouyierban opened this issue Nov 5, 2024 · 8 comments · Fixed by #564
Labels

Comments

@shouyierban
Copy link

Thank you for you job, it is a very usefull plugins.

Long story shart, I were using wezterm with nushell in windows systerm. when I run codes with hover actions, the terminal always fails to execute commands. It seems that the correct path cannot be opened. Normally, nushell does not need to "" when execute cd commands.

Quicker1

@mrcjkb mrcjkb changed the title can not run in nushell [Windows] Cannot run in nushell Nov 5, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Nov 5, 2024

Hey 👋

I can't reproduce this on Linux, so it appears to be a Windows only issue.
You often don't need to quote paths, even with other shells, but it makes it easier to handle paths containing spaces.

Are you able to run the command in nushell on Windows?
By the looks of it, nushell is removing \t and \b (which it may be interpreting as whitespace, e.g. \t = TAB?).
If you cannot run the command in nushell on Windows, I would say this is likely a nushell bug.

@mrcjkb mrcjkb added the upstream label Nov 5, 2024
@shouyierban
Copy link
Author

shouyierban commented Nov 6, 2024

Hey 👋

I can't reproduce this on Linux, so it appears to be a Windows only issue. You often don't need to quote paths, even with other shells, but it makes it easier to handle paths containing spaces.

Are you able to run the command in nushell on Windows? By the looks of it, nushell is removing \t and \b (which it may be interpreting as whitespace, e.g. \t = TAB?). If you cannot run the command in nushell on Windows, I would say this is likely a nushell bug.

Thanks for reply.
If I execute the following command in nushell, can work very well.
cd E:\tmp\bba | cargo run --package bba --bin bba --all-features

This is no problem, even if I run the file in the current folder.
cargo run main.rs

The above problem only occurs when I use hover actions, it automatically cd the path and adds "". Is there any way to make it pass the path without adding the""?

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 6, 2024

If I execute the following command in nushell, can work very well.
cd E:\tmp\bba | cargo run --package bba --bin bba --all-features

That is not what I asked, sorry. Let me clarify:
I asked if you can run cd "E:\tmp\bba" (with quotes) in nushell on Windows. If not, it's possibly a nushell on Windows bug, because that is possible on UNIX systems.

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 6, 2024

See also this comment:

Strings with spaces have to be quoted: print "hello, world".

To be able to handle paths with spaces, they must be quoted. This is the case for nushell too.
Closing, as this is a bug in nushell on Windows. There's nothing I can do here. Please open an issue in the nushell repository, if none exists.

@mrcjkb mrcjkb closed this as completed Nov 6, 2024
@shouyierban
Copy link
Author

Hi @mrcjkb , I found the cause of the problem finally. When nushell executes the command, the backslash in double quotes is treated as an escape character. So just replace the double quotes with single quotes or delete to solve the problem when create cd command for the path.
please find the source code in line 47 of ./lua/rustaceanvim/shell.lua,
change return ('cd "%s" '):format(path) to return ('cd %s'):format(path) or return ("cd '%s' "):format(path)

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 9, 2024

I've implemented a fix. But again, this is a bug in Nushell on Windows and should be reported there.

@mikavilpas
Copy link

I have been thinking this could be a neovim bug, specific to nushell and windows. I had a long discussion about something similar in a bug report in yazi.nvim here mikavilpas/yazi.nvim#366

If anyone finds some information about this (maybe a fix), I would appreciate a message, for example in this thread.

Wishing everyone a nice weekend 🙂

@shouyierban
Copy link
Author

@mrcjkb It works very well after updating. Thanks for your job, and thanks for @mikavilpas suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants