Commit 5b55287b authored by andyzhangx's avatar andyzhangx

fix nsenter GetFileType issue

use outputBytes as return error
parent a95d6cb0
...@@ -235,8 +235,13 @@ func (n *NsenterMounter) MakeRShared(path string) error { ...@@ -235,8 +235,13 @@ func (n *NsenterMounter) MakeRShared(path string) error {
func (mounter *NsenterMounter) GetFileType(pathname string) (FileType, error) { func (mounter *NsenterMounter) GetFileType(pathname string) (FileType, error) {
var pathType FileType var pathType FileType
outputBytes, err := mounter.ne.Exec("stat", []string{"-L", `--printf "%F"`, pathname}).CombinedOutput() outputBytes, err := mounter.ne.Exec("stat", []string{"-L", "--printf=%F", pathname}).CombinedOutput()
if err != nil { if err != nil {
if strings.Contains(string(outputBytes), "No such file") {
err = fmt.Errorf("%s does not exist", pathname)
} else {
err = fmt.Errorf("stat %s error: %v", pathname, string(outputBytes))
}
return pathType, err return pathType, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment