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 scoop version causes 'Open With' dialogue #1306

Open
Tyecon opened this issue Mar 26, 2024 · 7 comments
Open

Windows scoop version causes 'Open With' dialogue #1306

Tyecon opened this issue Mar 26, 2024 · 7 comments
Assignees
Labels
os: windows windows compatibility priority 2: medium Default for bugs type: bug something isn't working

Comments

@Tyecon
Copy link

Tyecon commented Mar 26, 2024

OS: Windows 10
Shell: Powershell 5.1.19041 in Windows Terminal
Ani-Cli Version: 4.8.0

Behaviours:
ani-cli: Open-With Dialogue, no program does anything (tried cmd.exe, ps.exe, mpv)
ani-cli.cmd: Works as expected in powershell
~\scoop\shims\ani-cli: Opens in new cmd.exe window but works
~\scoop\shims\ani-cli.cmd: Works as expected
cd ~\scoop\shims\ then .\ani-cli: Works as expected
Renaming to ani-cli.exe does nothing.
Other scoop based programs don't have this same behaviour.
Various Set-ItemProperty settings don't seem to help (Read and Execute is true).

Might just be something weird with my terminal, but I might as well post the workarounds to help anyone that comes across the strange behaviour.

@Tyecon Tyecon added priority 2: medium Default for bugs type: bug something isn't working labels Mar 26, 2024
@port19x
Copy link
Collaborator

port19x commented Apr 12, 2024

Renaming to ani-cli.exe does nothing

good effort 🫡

Not sure we can do anything here

@port19x port19x added the os: windows windows compatibility label Apr 12, 2024
@ykhan21
Copy link
Contributor

ykhan21 commented Apr 14, 2024

@Tyecon, to run ani-cli are you double-clicking the ani-cli files?
Once you scoop install ani-cli, to run ani-cli you simply need to type ani-cli in your terminal and hit Enter. This should work in any directory as scoop adds ani-cli to the Windows path.
You could also avoid opening the terminal to enter ani-cli by entering ani-cli in Run. Open Run with Win+R.
ani-cli is not intended to be double-clicked. @port19x, correct me if I'm wrong.

@Tyecon
Copy link
Author

Tyecon commented Apr 15, 2024

No, the things I've put in the code blocks are exactly what I'm entering in the terminal. Windows run dialogue does the same things. The shims folder is on the PATH env-var.

@ykhan21
Copy link
Contributor

ykhan21 commented Apr 17, 2024

ani-cli should work on cmd, powershell, pwsh, and bash (Git Bash).

Entering ani-cli in cmd and powershell / pwsh should run the ~/scoop/shims/ani-cli.cmd cmd file.
Entering ani-cli in bash should run the ~/scoop/shims/ani-cli sh file.

~/scoop/shims/ani-cli will actually run ~/scoop/shims/ani-cli.cmd in powershell / cmd.
You could test this by creating a file called test01.cmd with the line "dir" with this command: echo dir > test01.cmd. Create a second file called test01 with the line "help" with this command: echo help > test01. Run .\test01. Observe that it runs the cmd file.

I think you get the Open-With dialog because your shell is trying to run the ~/scoop/shims/ani-cli file which is an sh file for bash. If you create a file called test02 with the line "ls" with the command echo ls > test02, running .\test02 will open the Open-With dialog.
I'm guessing here, but it could be because of some access / permission issue or scoop was not set up right.

  1. Can you try to reinstall ani-cli? scoop uninstall ani-cli followed by scoop install ani-cli should do it.
  2. What does running cd ~\scoop\shims\ followed by ani-cli (without the .\) output?
  3. Does ani-cli work in Git Bash?
  4. Can you share your ~\scoop\shims\ani-cli and ~\scoop\shims\ani-cli.cmd files?
  5. Try deleting or renaming the ~\scoop\shims\ani-cli (to get it out of the way). Does ani-cli work?

@Tyecon
Copy link
Author

Tyecon commented Apr 17, 2024

The echo files will open-with with no suffix. With .cmd it seems that echo places an unknown character at the start that breaks it.

→ C:\Users\Tyecon\scoop\shims› echo dir > test01.cmd
→ C:\Users\Tyecon\scoop\shims› test01.cmd

C:\Users\Tyecon\scoop\shims>■d
'■d' is not recognized as an internal or external command,
operable program or batch file.
  1. Reinstalling changed nothing
  2. While in the shims folder ani-cli causes open-with, .\ani-cli works normally.
  3. Works just fine in git bash
→ C:\Users\Tyecon› cat ~/scoop/shims/ani-cli
#!/bin/sh
# C:\Users\Tyecon\scoop\apps\ani-cli\current\ani-cli
"C:\Users\Tyecon\scoop\apps\ani-cli\current\ani-cli"  "$@"

→ C:\Users\Tyecon› cat ~/scoop/shims/ani-cli.cmd
@rem C:\Users\Tyecon\scoop\apps\ani-cli\current\ani-cli
@"C:\Program Files\Git\bin\bash.exe" "C:\Users\Tyecon\scoop\apps\ani-cli\current\ani-cli"  %*
  1. Renaming it to ani-cli.exe still has the open-with dialogue but trying to run it otherwise gives executable is not valid error. Renaming it to ani-cli.sh makes it act as it would without a suffix.
  2. sh ani-cli works great, starts in it scoop/MINGW64.

I think I figured out that it's some oddity with my windows subsystem linux environment trying to run the sh scripts directly outside of bash. A lot of linux commands that normally wouldn't work in powershell work in mine because of WSL. So it's a shell script bug with WSL not ani-cli probably. I think some other programs I've used through scoop and choco just had different exe wrappers for it that worked.

@ykhan21
Copy link
Contributor

ykhan21 commented Apr 17, 2024

Sorry, I guess echo dir > test01.cmd would work in cmd.exe whereas echo dir > test01.ps1 would work in powershell.

A lot of linux commands that normally wouldn't work in powershell work in mine because of WSL.
What is on your PATH that causes this? scoop install MINGW? I have WSL too but don't find this behavior. If you find out what causes this, a PR could be made to the ani-cli scoop package to account for this case.

You could try adding a ~\scoop\shims\ani-cli.ps1 file and see whether powershell prioritizes the ps1 file. Another simple approach would be to add an ani-cli alias or function to your powershell profile so that the right ani-cli is run when you enter ani-cli.

You could also try removing ~\scoop\shims\ani-cli so only the cmd file would run (but then you couldn't use ani-cli in git bash).

@ykhan21
Copy link
Contributor

ykhan21 commented Apr 18, 2024

Also, what is the output of Get-ExecutionPolicy in powershell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows windows compatibility priority 2: medium Default for bugs type: bug something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants