Skip to content

Commit faf032f

Browse files
committed
fix: handle remote directories in copilot-install-server function
- Set `default-directory` to local home when installing the server from a remote directory.
1 parent 89e6b8d commit faf032f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

copilot.el

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -361,17 +361,21 @@ Incremented after each change.")
361361
(defun copilot-install-server ()
362362
"Interactively install server."
363363
(interactive)
364-
(if-let* ((npm-binary (executable-find "npm")))
365-
(progn
366-
(make-directory copilot-install-dir 'parents)
367-
(copilot-async-start-process
368-
nil nil
369-
npm-binary
370-
"-g" "--prefix" copilot-install-dir
371-
"install" (concat copilot-server-package-name
372-
(when copilot-version (format "@%s" copilot-version)))))
373-
(copilot--log 'warning "Unable to install %s via `npm' because it is not present" copilot-server-package-name)
374-
nil))
364+
(let* ((default-directory (if (file-remote-p default-directory)
365+
"~/"
366+
default-directory))
367+
(npm-binary (executable-find "npm")))
368+
(if npm-binary
369+
(progn
370+
(make-directory copilot-install-dir 'parents)
371+
(copilot-async-start-process
372+
nil nil
373+
npm-binary
374+
"-g" "--prefix" copilot-install-dir
375+
"install" (concat copilot-server-package-name
376+
(when copilot-version (format "@%s" copilot-version)))))
377+
(copilot--log 'warning "Unable to install %s via `npm' because it is not present" copilot-server-package-name)
378+
nil)))
375379

376380
;;;###autoload
377381
(defun copilot-uninstall-server ()

0 commit comments

Comments
 (0)