-
Notifications
You must be signed in to change notification settings - Fork 1.6k
@actions/exec: add support for using a shell to run commands #285
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ export interface ExecOptions { | |
/** optional. defaults to false */ | ||
silent?: boolean | ||
|
||
/** optional. Runs command inside of a shell. A different shell can be specified as a string. Defaults to false */ | ||
shell?: boolean | string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this affect the quoting rules on windows? linux? Lots of logic in tool runner to accurately deal with arg quoting for .exe and different rules for .cmd/.bat. Today not a problem on Linux because iirc node calls execv which takes an arg array. Different on Windows because everything gets joined into a single string. Does this introduce arg quoting challenges on Linux? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if so, are the quoting rules different depending on the shell? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @ericsciple, from the documentation of child_process options:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps on windows we could set On linux I don't know if there are any quoting differences, but I'd be happy to add more tests to find out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Other thoughts, spitballing... If drastically different, I wonder whether it would make more sense to be linux/mac only feature. If quoting issues on Linux, then existing workaround of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not entirely sure how to proceed with this @ericsciple. I understand the workaround, but I thought since node supports it natively, it could be low hanging fruit with a more elegant solution. Will more tests alleviate your concerns? I understand you are reluctant to accept this as there might be edge cases that break quoting. If so, I might need some help :) |
||
|
||
/** optional out stream to use. Defaults to process.stdout */ | ||
outStream?: stream.Writable | ||
|
||
|
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.
Suggest also adding a test for running bash shell within Windows. As bash is now supported by windows runners, it provides a universal target for actions wanting to execute shell commands.