Empty options must be entirely omitted.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-05-26 13:15:51 +02:00
parent 228f678c08
commit 550e241163

11
main.go
View File

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