Skip to content

Commit 4a009fd

Browse files
committed
Use cmd.Start() and Wait() for commands execution
Signed-off-by: Mayank Sachan <[email protected]>
1 parent 7979b7b commit 4a009fd

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pkg/mounter/utils/mounter_utils.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,27 @@ type MounterOptsUtils struct {
3434
func (su *MounterOptsUtils) FuseMount(path string, comm string, args []string) error {
3535
klog.Info("-FuseMount-")
3636
klog.Infof("FuseMount params:\n\tpath: <%s>\n\tcommand: <%s>\n\targs: <%v>", path, comm, args)
37-
out, err := command(comm, args...).CombinedOutput()
37+
cmd := command(comm, args...)
38+
err := cmd.Start()
3839
if err != nil {
39-
klog.Warningf("FuseMount: mount command failed: mounter=%s, args=%v, error=%v, output=%s", comm, args, err, string(out))
40-
klog.Infof("FuseMount: checking if path already exists and is a mountpoint: path=%s", path)
40+
klog.Errorf("FuseMount: command start failed: mounter=%s, args=%v, error=%v", comm, args, err)
41+
return fmt.Errorf("FuseMount: '%s' command start failed: %v", comm, err)
42+
}
43+
klog.Infof("FuseMount: command 'start' succeeded for '%s' mounter", comm)
44+
45+
err = cmd.Wait()
46+
if err != nil {
47+
klog.Warningf("FuseMount: command wait failed: mounter=%s, args=%v, error=%v", comm, args, err)
48+
klog.Infof("FuseMount: checking if path already exists and is a mountpoint. path=%s", path)
4149
if mounted, err1 := isMountpoint(path); err1 == nil && mounted { // check if bucket already got mounted
4250
klog.Infof("bucket is already mounted using '%s' mounter", comm)
4351
return nil
4452
}
45-
klog.Errorf("FuseMount: path is not mountpoint, mount failed: path=%s", path)
46-
return fmt.Errorf("'%s' mount failed: <%v>", comm, string(out))
53+
klog.Errorf("FuseMount: path is not mountpoint. Mount failed: mounter=%s, path=%s", comm, path)
54+
return fmt.Errorf("'%s' mount failed: %v", comm, err)
4755
}
48-
klog.Infof("mount command succeeded: mounter=%s, output=%s", comm, string(out))
56+
57+
klog.Infof("FuseMount: command 'wait' succeeded for '%s' mounter", comm)
4958
if err := waitForMount(path, 10*time.Second); err != nil {
5059
return err
5160
}

0 commit comments

Comments
 (0)