Skip to content

Commit 07b9b2f

Browse files
authored
Capture errors of gh codespace list in *codespaces-output* buffer
1 parent 61ee62c commit 07b9b2f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

codespaces.el

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@ When this is nil, the default of '/workspaces/<repo-name>' is used."
5757
"Set up the ghcs tramp-method. Should be called after requiring this package."
5858
(interactive)
5959
(with-current-buffer (get-buffer-create "*codespaces-output*")
60-
(special-mode))
60+
(special-mode))
6161
(unless (executable-find "gh")
6262
(user-error "Could not find `gh' program in your PATH"))
6363
(unless (featurep 'json)
6464
(user-error "Emacs JSON support not available; your Emacs is too old"))
65-
(let ((status (call-process "gh" nil nil nil "codespace" "list")))
66-
(unless (zerop status)
67-
(user-error "Command `gh codespace list` failed\nPlease run `gh codespace list` directly in a terminal to see more details")))
65+
(let ((status
66+
(let ((inhibit-read-only t))
67+
(shell-command
68+
(if (eq system-type 'windows-nt)
69+
"gh codespace list 1>NUL"
70+
"gh codespace list 1>/dev/null")
71+
nil "*codespaces-output*"))))
72+
(unless (zerop status)
73+
(user-error
74+
(concat "Command `gh codespace list` failed ... "
75+
"[See *codespaces-output* buffer for details]"))))
6876
(let ((ghcs (assoc "ghcs" tramp-methods))
6977
(ghcs-methods '((tramp-login-program "gh")
7078
(tramp-login-args (("codespace") ("ssh") ("-c") ("%h")))

0 commit comments

Comments
 (0)