Skip to content

Commit 85502d8

Browse files
committed
fix(cloudclaude): return remote mount path in timeout error
1 parent 35bf4bf commit 85502d8

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/cloudclaude/mount.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func mountWorkspace(conn *ssh.Client, localDir, remotePath string) (cleanup func
104104
return sess.Run(checkCmd)
105105
}
106106

107-
if err := waitForMount(check, 200*time.Millisecond, 10*time.Second); err != nil {
107+
if err := waitForMount(remotePath, check, 200*time.Millisecond, 10*time.Second); err != nil {
108108
sshfsSession.Close()
109109
<-sftpDone
110110
server.Close()
@@ -123,7 +123,7 @@ func mountWorkspace(conn *ssh.Client, localDir, remotePath string) (cleanup func
123123
}
124124

125125
// waitForMount 轮询 check 函数直到挂载就绪或超时。
126-
func waitForMount(check func() error, interval, timeout time.Duration) error {
126+
func waitForMount(mountPath string, check func() error, interval, timeout time.Duration) error {
127127
var lastErr error
128128
if err := check(); err == nil {
129129
return nil
@@ -140,7 +140,7 @@ func waitForMount(check func() error, interval, timeout time.Duration) error {
140140
select {
141141
case <-deadline.C:
142142
return &MountNotReadyError{
143-
MountPath: "(remote)",
143+
MountPath: mountPath,
144144
Timeout: timeout,
145145
LastErr: lastErr,
146146
}

internal/cloudclaude/mount_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func TestWaitForMount(t *testing.T) {
1111
t.Run("succeeds when check passes immediately", func(t *testing.T) {
1212
check := func() error { return nil }
1313

14-
err := waitForMount(check, 10*time.Millisecond, 100*time.Millisecond)
14+
err := waitForMount("/workspace", check, 10*time.Millisecond, 100*time.Millisecond)
1515
if err != nil {
1616
t.Fatalf("expected nil error, got %v", err)
1717
}
@@ -27,7 +27,7 @@ func TestWaitForMount(t *testing.T) {
2727
return nil
2828
}
2929

30-
err := waitForMount(check, 10*time.Millisecond, 500*time.Millisecond)
30+
err := waitForMount("/workspace", check, 10*time.Millisecond, 500*time.Millisecond)
3131
if err != nil {
3232
t.Fatalf("expected nil error, got %v", err)
3333
}
@@ -39,7 +39,7 @@ func TestWaitForMount(t *testing.T) {
3939
t.Run("returns MountNotReadyError on timeout", func(t *testing.T) {
4040
check := func() error { return errors.New("not mounted") }
4141

42-
err := waitForMount(check, 10*time.Millisecond, 50*time.Millisecond)
42+
err := waitForMount("/workspace", check, 10*time.Millisecond, 50*time.Millisecond)
4343
if err == nil {
4444
t.Fatal("expected error, got nil")
4545
}

0 commit comments

Comments
 (0)