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

Scripts cannot be used for subcommands on Windows #632

Open
straight-shoota opened this issue May 20, 2024 · 0 comments
Open

Scripts cannot be used for subcommands on Windows #632

straight-shoota opened this issue May 20, 2024 · 0 comments

Comments

@straight-shoota
Copy link
Member

When invokied with a command that is not defined (say shards foo), shards tries to find a program called shards-foo and executes that. This is a simple mechanism to enable extensions of shards features outside of the main binary.

On Windows, the subcommand is required to be a binary exectuable. Scripts files (batch or PowerShell) are not supported.

Script files require a file extension in order to be considered executable in Windows shell. So the file would need to be called shards-foo.bat, but that doesn't match shards-foo.

If you explicitly use the extension as part of the subcommand name, execution still fails because shell scripts cannot be launced like executables on Windows outside a shell environment.

$ shards foobar.ps1
Unhandled exception: Error executing process: 'C:\crystal\crystal\shards-foobar.ps1': Exec format error (IO::Error)

On posix systems this all works because script files don't need an extension and can be executed directly without a shell.
This should work on Windows as well.

We'll need to figure out the details, but I suppose we could look for files with script extensions as well, and if found, execute them in a shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant