[sg] legacy commands continue watching after compilation failures (#61274)

Allow legacy commands to fail compilation and continue watching
This commit is contained in:
James McNamara 2024-03-25 13:26:26 -07:00 committed by GitHub
parent 27ba9a7671
commit c2db9d077d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -106,6 +106,12 @@ func (runner *cmdRunner) run(ctx context.Context) error {
shouldRestart, err := runner.reinstall(ctx, cmd)
if err != nil {
runner.printError(cmd, err)
// If the error came from the install step then we continue watching
// and will retry building if there is another source change.
if _, ok := err.(installErr); ok {
continue
}
return err
}
@ -164,7 +170,6 @@ func (runner *cmdRunner) reinstall(ctx context.Context, cmd SGConfigCommand) (bo
}
if err := installer.RunInstall(ctx, runner.parentEnv); err != nil {
runner.printError(cmd, err)
return false, err
}
newHash, err := md5HashFile(bin)

View File

@ -287,6 +287,7 @@ commands:
export GCFLAGS='all=-N -l'
fi
go build -gcflags="$GCFLAGS" -o .bin/worker github.com/sourcegraph/sourcegraph/cmd/worker
checkBinary: .bin/worker
watch:
- lib
- internal