Skip to content

Commit 5d9186e

Browse files
committed
fix: Setup did not work in OS with other language
1 parent b3835ca commit 5d9186e

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

internal/plugin/plugin.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,34 @@ func (m *Manager) CreateJunction(enginePath, worktreePath string) error {
130130
return fmt.Errorf("failed to create junction: %v, output: %s, error: %s", err, outputStr, errorStr)
131131
}
132132

133-
// Verify the junction was actually created
134-
// Check for both junction and symbolic link success messages
135-
successMessages := []string{
136-
"Junction created for",
137-
"symbolic link created for",
138-
"created for",
139-
}
140-
141-
success := false
142-
for _, msg := range successMessages {
143-
if strings.Contains(outputStr, msg) {
144-
success = true
145-
break
133+
// Locale-agnostic verification: inspect filesystem instead of parsing localized output
134+
// 1) Path must now exist
135+
fi, lerr := os.Lstat(pluginLinkPath)
136+
if lerr != nil {
137+
return fmt.Errorf("link not created at %s: %v", pluginLinkPath, lerr)
138+
}
139+
140+
// 2) If it's a symlink, ensure it points to the expected worktree
141+
if fi.Mode()&os.ModeSymlink != 0 {
142+
target, rerr := os.Readlink(pluginLinkPath)
143+
if rerr != nil {
144+
return fmt.Errorf("could not read symlink target: %v", rerr)
146145
}
146+
expectedAbs, _ := filepath.Abs(worktreePath)
147+
targetAbs, _ := filepath.Abs(target)
148+
if expectedAbs != targetAbs {
149+
return fmt.Errorf("symlink target mismatch: got %s, want %s", targetAbs, expectedAbs)
150+
}
151+
return nil
152+
}
153+
154+
// 3) Otherwise verify it's a junction/reparse point and points to the worktree
155+
if !m.JunctionExists(pluginLinkPath) {
156+
return fmt.Errorf("created path is not a junction or symlink: %s", pluginLinkPath)
147157
}
148158

149-
if !success {
150-
return fmt.Errorf("junction creation may have failed - unexpected output: %s", outputStr)
159+
if !m.VerifyJunction(enginePath, worktreePath) {
160+
return fmt.Errorf("junction does not point to expected target: %s", worktreePath)
151161
}
152162

153163
return nil

0 commit comments

Comments
 (0)