-
Notifications
You must be signed in to change notification settings - Fork 363
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
#452 Fix broken Windows shell commands by running through shx. #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if we can auto-discover these commands in task.exec() and add shx automatically?
What mechanism have you got in mind for the auto-discovery? |
For example we can have a list of supported commands in shx and when the runtime identifies that we are on windows, it will pass the exec command through it. |
In the spirit of YAGNI, what benefit does this (OS discovery) give us versus just passing the currently broken |
Having given it some further thought, I don't disagree with the idea of supporting other commands per se, but I think determining whether a command matches something in a defined list of supported shx commands could be a pain. Whilst it's trivial to do a replace in the string of a matching command (e.g.
(Apologies for the badly formatted My instinct is to make this the responsibility of the person writing the command(s) to ensure OS compatibility as the user themselves requires it and just wrap the commands that are inside projen with shx. Just my 2c, though. |
This feels too error prone and easy to forget to do. If there's a way we can encapsulate this behavior behind the task runner, I rather we take that path. |
Closing in the meantime, feel free to open when you'd like to continue working on this. 🙏 |
Hm, why not run all commands passed to |
In the meantime @iwt-janbrauer, here's what I use in my
|
This PR tries to address #452 by wrapping the commands 'rm', 'mkdir' and 'mv' with `shx`. A whitelist of commands is maintained in the task runtime. @eladb Is this what you had in mind when commenting on #540? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
shx is added as a dev dependency in order for it to be available for use in scripts. Linux script commnds (e.g.
rm -fr ...
) are modified to run throughshx
in order to be supported on Windows.