mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 06:20:48 +02:00
fuse integration: resolve the weed binary to an absolute path
The started processes run with cmd.Dir at the framework's temp dir, so a relative candidate like ../weed no longer resolves. Prefer PATH, then probe the usual build outputs and return absolute paths only. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
18c27508f6
commit
245fada966
1 file changed
+13
-12
@@ -395,23 +395,24 @@ func (f *FuseTestFramework) waitForMount(timeout time.Duration) error {
|
||||
return fmt.Errorf("mount point not ready within timeout")
|
||||
}
|
||||
|
||||
// findWeedBinary locates the weed binary
|
||||
// findWeedBinary locates the weed binary. Candidates are resolved to
|
||||
// absolute paths because the started processes run with cmd.Dir set to the
|
||||
// framework's temp dir, where a relative path would not resolve.
|
||||
func findWeedBinary() string {
|
||||
// Try different possible locations
|
||||
candidates := []string{
|
||||
"./weed",
|
||||
"../weed",
|
||||
"../../weed",
|
||||
"weed", // in PATH
|
||||
if p, err := exec.LookPath("weed"); err == nil {
|
||||
return p
|
||||
}
|
||||
|
||||
candidates := []string{
|
||||
"../../weed/weed",
|
||||
"./weed",
|
||||
"../weed",
|
||||
}
|
||||
for _, candidate := range candidates {
|
||||
if _, err := exec.LookPath(candidate); err == nil {
|
||||
return candidate
|
||||
}
|
||||
if info, err := os.Stat(candidate); err == nil && !info.IsDir() && info.Mode()&0111 != 0 {
|
||||
abs, _ := filepath.Abs(candidate)
|
||||
return abs
|
||||
if abs, err := filepath.Abs(candidate); err == nil {
|
||||
return abs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user