Skip to content

Commit 0ec371f

Browse files
committed
fix: quote output of init command and args to prevent multiline log (#378)
(cherry picked from commit a9cb987)
1 parent ef45828 commit 0ec371f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

envbuilder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func Run(ctx context.Context, opts options.Options, preExec ...func()) error {
104104
return fmt.Errorf("set uid: %w", err)
105105
}
106106

107-
opts.Logger(log.LevelInfo, "=== Running the init command %s %+v as the %q user...", opts.InitCommand, args.InitArgs, args.UserInfo.user.Username)
107+
opts.Logger(log.LevelInfo, "=== Running init command as user %q: %q", args.UserInfo.user.Username, append([]string{opts.InitCommand}, args.InitArgs...))
108108
for _, fn := range preExec {
109109
fn()
110110
}

integration/integration_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestLogs(t *testing.T) {
8484
}
8585
for _, log := range req.Logs {
8686
t.Logf("got log: %+v", log)
87-
if strings.Contains(log.Output, "Running the init command") {
87+
if strings.Contains(log.Output, "Running init command") {
8888
close(logsDone)
8989
return
9090
}
@@ -2294,7 +2294,7 @@ func runEnvbuilder(t *testing.T, opts runOpts) (string, error) {
22942294
logChan, errChan := streamContainerLogs(t, cli, ctr.ID)
22952295
go func() {
22962296
for log := range logChan {
2297-
if strings.HasPrefix(log, "=== Running the init command") {
2297+
if strings.HasPrefix(log, "=== Running init command") {
22982298
errChan <- nil
22992299
return
23002300
}

0 commit comments

Comments
 (0)