-
Notifications
You must be signed in to change notification settings - Fork 93
Inline scripts executed via bash
or sh
#2896
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
Conversation
bash
or sh
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestShellExecvOpts(t *testing.T) { | ||
newOpts, err := shellExecvOpts("echo hello", "/a/b/c", []string{"key1=value1", "key2=value2"}) | ||
opts, err := shellExecvOpts("echo hello", "/a/b/c", []string{"key1=value1", "key2=value2"}) |
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.
small typo fix, newOpts -> opts
@@ -117,7 +117,11 @@ func TestExecutorNoShellFound(t *testing.T) { | |||
} | |||
|
|||
func TestExecutorCleanupsTempFiles(t *testing.T) { |
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.
Only cmd.exe cleans up temp files. Other shells now do not create temp files.
@shreyas-goenka Are there functional or behavioral differences between these execution modes that you know of? |
@pietern There is only one minor difference I found. Positional arguments (like I did not find any differences in the execution environment itself though. We also have coverage for some common patterns in #2884. Thanks for flagging, I just noticed a mistake I made. Since we stopped setting the |
@shreyas-goenka Thanks. Our docs don't mention anything specifically about how the build command is executed, but it does mention the double ampersand ( That can be updated to include line-separation, correct? |
## Changes This PR fixes a regression introduced in #2896 where we stopped passing the `-e` flag to the shell, which makes both sh and bash bail out at the first command with a non-zero exit code. ## Why Adding back `-e` keeps the behaviour consistent with the one before #2896 was introduced. ## Tests Newly added regression tests
@shreyas-goenka I mean they can be updated in the docs. They mention |
Changes
This PR inlines the script content using the
-c
flag in bash and sh instead of passing them in via-e <file>
.Why
Based on discussion in #2862 (comment). Getting rid of the temp file means we no longer have to clean up the temporary file created.
Tests
Tests that were added in: #2884