emacs-devel
[Top][All Lists]
Advanced

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

Re: & and M-& to run programs asynchronously


From: Jan Djärv
Subject: Re: & and M-& to run programs asynchronously
Date: Tue, 07 Jul 2009 12:02:43 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

Juri Linkov skrev:
I don't know if it's worth to open a new thread, but as this one is
related I'll like to report some problem I've had while testing the
new "&" command  (dired-do-async-shell-command).

If you use it to execute a command that opens a child process then it
will have no effect at all, the parent process will be finished and no
program will be executed. You can reproduce this if you execute &
xdg-open (freedesktop command for opening a file).

dired-do-shell-command does work when you use it to execute xdg-open,
but it will run the program synchronously.

Would it be possible to fix this so that "&" waits for child processes
running asynchronously to finish?

I see that running `M-! xdg-open file &' works correctly on KDE,
but fails on Gnome.  Is this an Emacs bug at all?


On my system emacs starts a shell in a subprocess that execs xdg-open.
xdg-open starts gnome-open in a subprocess and waits for it to finish. I presume KDE starts kde-open instead. gnome-open then starts the real program without waiting for it to finish.

I can see that gnome-open does not close the tty before execing the real program, so when the tty goes away (i.e. gnome-open finishes) a SIGHUP is sent. That means the program dies.

kde-open on the other hand does close the controlling tty.

One way to fix this in Emacs would be to keep the tty around as long as there are processes that has it open (like ssh does). But IMHO this is a bug in gnome-open.

        Jan D.




reply via email to

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