Skip to content

Commit 8635f11

Browse files
committed
fix(envbuilder): make init command more readable
1 parent 24ef801 commit 8635f11

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

envbuilder.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import (
4747
"github.com/google/go-containerregistry/pkg/v1/remote"
4848
"github.com/kballard/go-shellquote"
4949
"github.com/mattn/go-isatty"
50+
"github.com/mitchellh/go-wordwrap"
5051
"github.com/sirupsen/logrus"
5152
"github.com/tailscale/hujson"
5253
"golang.org/x/xerrors"
@@ -104,7 +105,11 @@ func Run(ctx context.Context, opts options.Options, preExec ...func()) error {
104105
return fmt.Errorf("set uid: %w", err)
105106
}
106107

107-
opts.Logger(log.LevelInfo, "=== Running init command as user %q: %q", args.UserInfo.user.Username, append([]string{opts.InitCommand}, args.InitArgs...))
108+
initCmd := append([]string{opts.InitCommand}, args.InitArgs...)
109+
opts.Logger(log.LevelInfo, "=== Running init command as user %q", args.UserInfo.user.Username)
110+
for _, line := range wordwrap.WrapString(initCmd, 76) {
111+
opts.Logger(log.LevelInfo, " "+line)
112+
}
108113
for _, fn := range preExec {
109114
fn()
110115
}

0 commit comments

Comments
 (0)