From 552db9de870d36b3f190a38097d82024edfb5b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Van=C3=AD=C4=8Dek?= Date: Fri, 26 May 2023 15:25:36 +0200 Subject: [PATCH] Process stop detection --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 8199e15..2c826c8 100644 --- a/main.go +++ b/main.go @@ -196,7 +196,8 @@ func (d ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error) // to initially connect. So we just wait a fixed amount of time and check for process exit. time.Sleep(1 * time.Second) log.WithFields(log.Fields{"name": r.Name}).Info("Process started") - if cmd.ProcessState.Exited() { + if cmd.ProcessState != nil { + // The process has exited so consider an error occured log.WithFields(log.Fields{"name": r.Name, "exitStatus": cmd.ProcessState.ExitCode()}).Error("Volume mount failed") return &volume.MountResponse{}, fmt.Errorf("unexpected error mounting '%s' exist status: %v", r.Name, cmd.ProcessState.ExitCode()) }