Run a program from Emacs and don't wait for output

start-process function can handle that:

(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)

Start a program in a subprocess.  Return the process object for it.
NAME is name for process.  It is modified if necessary to make it unique.
BUFFER is the buffer (or buffer name) to associate with the process.

Process output (both standard output and standard error streams) goes
at end of BUFFER, unless you specify an output stream or filter
function to handle the output.  BUFFER may also be nil, meaning that
this process is not associated with any buffer.

PROGRAM is the program file name.  It is searched for in `exec-path'
(which see).  If nil, just associate a pty with the buffer.  Remaining
arguments are strings to give program as arguments.

If you want to separate standard output from standard error, invoke
the command through a shell and redirect one of them using the shell
syntax.

If you don't want to associate bufer with open process — pass nil as BUFFER argument


See C-h k M-!

... If COMMAND ends in ampersand, execute it asynchronously. The output appears in the buffer `Async Shell Command'. That buffer is in shell mode. ...

IOW, M-! my_command --opt=foo arg1 arg2 & will start my_command and create a *Async Shell Command* buffer with my_command running in it but emacs will give control back to you right away.

Tags:

Emacs