help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asynchronous shell command that leaves a background process running


From: Pascal J. Bourguignon
Subject: Re: Asynchronous shell command that leaves a background process running
Date: Wed, 08 Dec 2010 15:32:42 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Sean McAfee <eefacm@gmail.com> writes:

> I've written a shell script which is essentially a single exec command:
>
>   #!/bin/bash
>   exec real-program fixedarg1 fixedarg2 "$@"
>
> "real-program" chugs along for several seconds, printing some status
> messages in the meantime, before finally forking off a background
> process and exiting.  The background process manifests a window on my
> desktop.
>
> All is well when I run this command from an interactive shell, but
> things fall apart when I try to run it as an asynchronous shell command
> from Emacs, a la:
>
>   (shell-command "wrapper-script arg1 arg2 &")
> [...]
> Is there a more elegant way to address this problem?

You can use:

  (shell-command "wrapper-script arg1 arg2 & disown")


But really, the problem is with your real-program, which should be doing
the same as disown (setting a new process group, etc), since it exits
before its children.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]