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

no behavior at all on windows? #103

Open
henriqpsantos opened this issue Oct 6, 2021 · 5 comments
Open

no behavior at all on windows? #103

henriqpsantos opened this issue Oct 6, 2021 · 5 comments

Comments

@henriqpsantos
Copy link

Doing this exact series of commands (or any commands at all) does not work on windows. I'm sure sad is functional (--version, --help both work), fzf and delta are both installed as well. But no actual sad (haha) commands work, just print \n and exit. Is this me being dumb??

Plain text, tex file as an example:
image

os + shell
Nu ❯ sys | get host:
Windows - 10 (19043) | using nushell 0.38 here, but powershell gives similarly depressing results

@musjj
Copy link

musjj commented Mar 1, 2023

It's not working for me either. fzf pops up, but displays no results. Tried --fzf never too, but still no output.
Also tried the latest commit (fc1a98a), but no luck,

@SeryiBaran
Copy link

Same problem :(

Any news?

@sergeevabc
Copy link

Dear @ms-jpq, the developer of sad, could you be so kind to come out of the anabiosis and squeeze out a couple of meaningful sentences on how to run the app under Windows so that it replaces anything at all?

@hxtk
Copy link

hxtk commented May 10, 2024

It looks to me like in the latest version, it can't read a file listing piped in via powershell because powershell normalizes all text pipes to be at least one line and have all lines terminated by \r\n. This breaks the behavior of, e.g., fd -tf | sad foo bar, because \r is at the end of every candidate filename. I've created a patch for that locally and can submit a pull request if contributions are welcome.

fd -tf -0 | sad -0 foo bar is also broken because of the normalization of text pipes to have "at least one line", i.e., \r\n is appended to the end of the stream. Technically, I'm not sure how best to handle this because I think the point of -0 is to support file names that would normally be difficult to parse out of a newline-delimited list. I could just make a patch to drop the last input string if it is \r\n in -0 mode, but that would break the use case of having a file named \r\n, which is unfortunately possible in some obscure edge cases, but feels very illegal.

And finally, sad seems to die immediately if it encounters an Access Denied error, which incidentally happens on my machine when trying to open a directory as if it were a file, so all of the examples with fd | sad foo bar have to be replaced with fd -tf | sad foo bar (and possibly -tl if you care about symlinks). I could imagine either documenting this behavior or making a patch that skips any directories passed in.

However, using bash on Windows seems to work exactly as expected, at least in terms of piping behavior.

@sergeevabc
Copy link

I still don't understand how to use sad, which is really sad.

Windows 7 x64, sad 0.4.28

$ echo good | sad good bye
Error: IO("good \r", InvalidFilename)

$ sad good bye input.txt
error: unexpected argument 'input.txt' found

$ type input.txt | sad good bye
(nothing happens)

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

No branches or pull requests

5 participants