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

Add execute to run a command without a shell (and use it to u-opt git usage) #217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

compnerd
Copy link
Contributor

@compnerd compnerd commented May 9, 2021

This adds a new utility function execute which executes a command without the assumption that there is a POSIX-like shell being used. This functionality is needed to eventually solve #213. However, it is still useful to perform some micro-optimizations of avoiding the shell when using git.

This new function is similar to `run` except that it requires that the
arguments be passed properly quoted and pre-split through an array.  It
also will not permit the prefixing a command for execution.  The major
difference between `run` and `execute` is that `execute` will not go
through a shell, so parameter expansion, variable substitution, etc do
not occur.  Additionally, because there is no shell involved, a single
process is created rather than two processes (one for the shell, and the
actual process being invoked).  This is required to enable using this
action on Windows, where the process redirection does not work as the
shell used is different.
Use the newly minted `execute` to directly execute the `git` process.
This should be a slight bit faster as no new shell process needs to be
setup.
@ocean90
Copy link
Member

ocean90 commented May 17, 2021

We should probably switch to @actions/exec "to execute tools in a cross platform way".

@compnerd
Copy link
Contributor Author

@ocean90 execute is actually using spawnSync rather than exec, which doesn't have the same exact semantics.

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

Successfully merging this pull request may close these issues.

None yet

3 participants