Skip to content

Commit

Permalink
fix: quote output of init command and args to prevent multiline log (#…
Browse files Browse the repository at this point in the history
…378)

(cherry picked from commit a9cb987)
  • Loading branch information
mafredri committed Oct 2, 2024
1 parent ef45828 commit 0ec371f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func Run(ctx context.Context, opts options.Options, preExec ...func()) error {
return fmt.Errorf("set uid: %w", err)
}

opts.Logger(log.LevelInfo, "=== Running the init command %s %+v as the %q user...", opts.InitCommand, args.InitArgs, args.UserInfo.user.Username)
opts.Logger(log.LevelInfo, "=== Running init command as user %q: %q", args.UserInfo.user.Username, append([]string{opts.InitCommand}, args.InitArgs...))
for _, fn := range preExec {
fn()
}
Expand Down
4 changes: 2 additions & 2 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestLogs(t *testing.T) {
}
for _, log := range req.Logs {
t.Logf("got log: %+v", log)
if strings.Contains(log.Output, "Running the init command") {
if strings.Contains(log.Output, "Running init command") {
close(logsDone)
return
}
Expand Down Expand Up @@ -2294,7 +2294,7 @@ func runEnvbuilder(t *testing.T, opts runOpts) (string, error) {
logChan, errChan := streamContainerLogs(t, cli, ctr.ID)
go func() {
for log := range logChan {
if strings.HasPrefix(log, "=== Running the init command") {
if strings.HasPrefix(log, "=== Running init command") {
errChan <- nil
return
}
Expand Down

0 comments on commit 0ec371f

Please sign in to comment.