Skip to content

Commit

Permalink
telemetry: check telemetry.LocalDir exists before starting child
Browse files Browse the repository at this point in the history
Both crash monitoring and uploading require the local dir, and the
child's working directory is set to LocalDir, so don't start the child
if LocalDir does not exist.

Change-Id: I8576d40f729f6f5389680b7b8d7187f5365c9dd2
Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/569297
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
matloob committed Mar 6, 2024
1 parent 5f08a0c commit d5a85b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions start.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ func Start(config Config) {

counter.Open()

if _, err := os.Stat(telemetry.LocalDir); err != nil {
// There was a problem statting LocalDir, which is needed for both
// crash monitoring and counter uploading. Most likely, there was an
// error creating telemetry.LocalDir in the counter.Open call above.
// Don't start the child.
return
}

// Crash monitoring and uploading both require a sidecar process.
if (config.ReportCrashes && crashmonitor.Supported()) || (config.Upload && mode != "off") {
if os.Getenv(telemetryChildVar) != "" {
Expand Down

0 comments on commit d5a85b2

Please sign in to comment.