Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/devcontainer/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ func (c *initCmdContext) runSingle(name string, cmd []string) error {
c2.Stderr = errwriter
c2.Dir = c.workspaceFolder
c2.Env = env
return c2.Run()
if err := c2.Run(); err != nil {
return fmt.Errorf("initializeCommand %q failed: %w", name, err)
}
return nil
}

func getWorkspace(
Expand Down
6 changes: 3 additions & 3 deletions pkg/devcontainer/setup/lifecyclehooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ func runSingleHookCommand(
Env: append(os.Environ(), remoteEnvArr...),
}

return executeAndLog(cmd, key, c)
return executeAndLog(cmd, p.name, key, c)
}

func executeAndLog(cmd *exec.Cmd, key string, c []string) error {
func executeAndLog(cmd *exec.Cmd, phaseName string, key string, c []string) error {
stdoutPipe, err := cmd.StdoutPipe()
if err != nil {
return fmt.Errorf("failed to get stdout pipe: %w", err)
Expand Down Expand Up @@ -526,7 +526,7 @@ func executeAndLog(cmd *exec.Cmd, key string, c []string) error {
cmd.Args,
err,
)
return fmt.Errorf("failed to run: %s, error: %w", strings.Join(c, " "), err)
return fmt.Errorf("%s: command %q failed: %w", phaseName, strings.Join(c, " "), err)
}

log.Infof("ran command: command=%s, args=%s", key, strings.Join(c, " "))
Expand Down
Loading