-
Notifications
You must be signed in to change notification settings - Fork 126
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
Fix calling kscript.bat by symlink and PowerShell compatibility #390
Fix calling kscript.bat by symlink and PowerShell compatibility #390
Conversation
Hi! First of all, thanks for providing the PR. I am happy to merge it. My only concerns are connected with the options 's' and 'i', which were available in
's' is for short file names - I guess it should stay, but I am not sure about 'i'. |
As I understand the script
can be translated to kotlin-like pseudocode this way:
The whole loop is equivalent to |
@goto1134 - I have merged the PR. If you would like to work on something regarding Windows compatibility, I will gladly welcome the patches. For example distribution package for windows is needed: scoop or choco (mostly investigation first). Other than that, more tests in all areas are always welcome. Thanks a lot for your contribution! |
Actually we merged kscript to scoop recently ScoopInstaller/Extras#9353. The reason I came here is that the scoop packaged kscript does not work without this fix. Maybe I could help with choco too |
That sounds cool! I have created an issue for that: It would be great if you could document in a simple way how to start and, later, how to do releases. Then I will be able to create release scripts. I have no idea what should be done, so you can probably help also in other ways. :-) |
Actually you don't need to do anything specific. Just stick to the current GitHub release format and scoop should automatically update the package version once in a while. If you are interested in how scoop works, you should check its wiki. |
Great! I am working on the release scripts based on kscript, but they need to be more stable, to ask you for help with them. For now, I will reference you in the ticket and add a link to the wiki. You are welcome to add additional comments to the ticket. |
The scenario:
kscript "println('1')"
in cmd orkscript """println('1')"""
in PowerShell.You will get the following error:
The reason is that kscript.bat strictly depends on kscript.bat being in your PATH. It uses
where
(where.exe
fromSystem32
) to locate the kscript.bat in the PATH.Another problem with this approach is that when executed in PowerShell,
where
becomes an alias to theWhere-Object
PowerShell function, which returns an empty string.The provided solution both makes symlinks work and fixes compatibility with PowerShell.