File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -294,12 +294,18 @@ export class LocalRuntime implements Runtime {
294294 }
295295 }
296296
297- resolvePath ( filePath : string ) : Promise < string > {
297+ async resolvePath ( filePath : string ) : Promise < string > {
298298 // Expand tilde to actual home directory path
299299 const expanded = expandTilde ( filePath ) ;
300+ const absolute = path . resolve ( expanded ) ;
300301
301- // Resolve to absolute path (handles relative paths like "./foo")
302- return Promise . resolve ( path . resolve ( expanded ) ) ;
302+ try {
303+ // Try to resolve symlinks (canonical path)
304+ return await fsPromises . realpath ( absolute ) ;
305+ } catch {
306+ // If file doesn't exist or other error, return absolute path
307+ return absolute ;
308+ }
303309 }
304310
305311 normalizePath ( targetPath : string , basePath : string ) : string {
Original file line number Diff line number Diff line change @@ -392,7 +392,8 @@ export class SSHRuntime implements Runtime {
392392 // Use shell to expand tildes on remote system
393393 // Bash will expand ~ automatically when we echo the unquoted variable
394394 // This works with BusyBox (doesn't require GNU coreutils)
395- const command = `bash -c 'p=${ shescape . quote ( filePath ) } ; echo $p'` ;
395+ // We use readlink -f to resolve symlinks if possible, falling back to just echo
396+ const command = `bash -c 'p=${ shescape . quote ( filePath ) } ; readlink -f "$p" 2>/dev/null || echo "$p"'` ;
396397 // Use 10 second timeout for path resolution to allow for slower SSH connections
397398 return this . execSSHCommand ( command , 10000 ) ;
398399 }
You can’t perform that action at this time.
0 commit comments