Skip to content

Instantly share code, notes, and snippets.

@hara-y-u
Created March 1, 2012 14:10
Show Gist options
  • Save hara-y-u/1950055 to your computer and use it in GitHub Desktop.
Save hara-y-u/1950055 to your computer and use it in GitHub Desktop.
同期的にシェルコマンドを実行して出力を返す elisp 関数
(defun exec-shell-command-sync (command &rest args)
(let (ret
(process
(apply 'start-process-shell-command "exec" nil command args)))
(set-process-filter
process
'(lambda (process output)
(setq ret (cons output ret))
))
(while (not (equalp (process-status process) 'exit))
(sleep-for 0 10))
(car ret)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment