Skip to content

Commit 8da6bee

Browse files
committed
show user friendly error if git is not found
1 parent 19fb41e commit 8da6bee

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

components/supervisor/cmd/init.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ var initCmd = &cobra.Command{
3838
)
3939
signal.Notify(sigInput, os.Interrupt, syscall.SIGTERM)
4040

41+
// check if git executable exists, supervisor will fail if it doesn't
42+
// checking for it here allows to bubble up this error to the user
43+
_, err = exec.LookPath("git")
44+
if err != nil {
45+
log.WithError(err).Fatal("cannot find git executable, make sure it is installed as part of gitpod image")
46+
}
47+
4148
supervisorPath, err := os.Executable()
4249
if err != nil {
4350
supervisorPath = "/.supervisor/supervisor"

components/supervisor/pkg/supervisor/supervisor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ func Run(options ...RunOption) {
188188
log.WithError(err).Fatal("cannot ensure Gitpod user exists")
189189
}
190190
symlinkBinaries(cfg)
191+
191192
configureGit(cfg, childProcEnvvars)
192193

193194
tokenService := NewInMemoryTokenService()

0 commit comments

Comments
 (0)