Equivalent to "exec" in emacs * eshell *?

I want to write an eshell function, which is a shell of an existing script command line. To do this, I want to be able to execute a shell command from an eshell function. My first instinct was to do something like

(defn eshell/myfunc ()
  (shell-command "mycommand"))

And such work, with the exception of a few problems. It works in the bottom shell instead of behaving like a real "exec" command. This means that, among other things, the "myfunc" command in eshell seems to be blocked during the execution of the command. The output of the "mycommand" command is collected in the shell output buffer at the end, but it does not replicate the behavior of the normal shell function, where standard output appears at run time.

So what is the right way to do this?

+5
source share
1 answer

Try

(start-process-shell-command "foo" (current-buffer) "mycommand")

If you need more control, see Emacs Lisp Summary Guide, Sectioin 37.4 Creating an Asynchronous Process .

+2
source

All Articles