From 550e241163c223e38044831bc10ba49538da9aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Van=C3=AD=C4=8Dek?= Date: Fri, 26 May 2023 13:15:51 +0200 Subject: [PATCH] Empty options must be entirely omitted. --- main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 3c909aa..4a26796 100644 --- a/main.go +++ b/main.go @@ -164,15 +164,14 @@ func (d ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error) return &volume.MountResponse{}, err } - var opts string + // Note: The first argument ("mount") causes running in the foreground, its absence in the background + var cmd *exec.Cmd if len(v.opts) == 0 { - opts = "" + cmd = exec.Command("/sbin/mount.objectivefs", "mount", v.fs, v.volume.Mountpoint) } else { - opts = "-o" + v.opts + cmd = exec.Command("/sbin/mount.objectivefs", "mount", "-o"+v.opts, v.fs, v.volume.Mountpoint) } - // Note: The first argument ("mount") causes running in the foreground, its absence in the background - cmd := exec.Command("/sbin/mount.objectivefs", "mount", opts, v.fs, v.volume.Mountpoint) cmd.Env = v.env cmdReader, _ := cmd.StderrPipe() log.WithFields(log.Fields{ @@ -194,7 +193,7 @@ 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) if cmd.ProcessState.Exited() { - return &volume.MountResponse{}, fmt.Errorf("unexpected error mounting '%s' exist status: %d", r.Name, cmd.ProcessState.ExitCode()) + return &volume.MountResponse{}, fmt.Errorf("unexpected error mounting '%s' exist status: %v", r.Name, cmd.ProcessState.ExitCode()) } v.mounted = true