diff --git a/emacs/.emacs.d/config/init-aws.el b/emacs/.emacs.d/config/init-aws.el index 6a43c87..8b1d16d 100644 --- a/emacs/.emacs.d/config/init-aws.el +++ b/emacs/.emacs.d/config/init-aws.el @@ -30,7 +30,16 @@ (defun aws-sso-login () (interactive) - (async-shell-command "AWS_PROFILE=default aws sso login")) + (let ((buffer "*aws-sso-login*")) + (async-shell-command "AWS_PROFILE=default aws sso login" buffer) + (with-current-buffer buffer + (let ((proc (get-buffer-process (current-buffer)))) + (set-process-sentinel + proc + (lambda (proc sentinel) + (when (string-match-p "finished" sentinel) + (with-selected-window (get-buffer-window (process-buffer proc) t) + (quit-window))))))))) (add-hook 'emacs-startup-hook (lambda ()