Skip to content

Commit 1512a76

Browse files
sagor999roboquat
authored andcommitted
show user friendly error if git is not found
1 parent 301547d commit 1512a76

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

components/supervisor/cmd/init.go

+7
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

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ func Run(options ...RunOption) {
192192
log.WithError(err).Fatal("cannot ensure Gitpod user exists")
193193
}
194194
symlinkBinaries(cfg)
195+
195196
configureGit(cfg, childProcEnvvars)
196197

197198
tokenService := NewInMemoryTokenService()

0 commit comments

Comments
 (0)