On Tue, Jun 29, 2010 at 06:52, Jeff Forcier <j...@bitprophet.org> wrote: > Hi Kenji, > > The problem is not the daemonizing but the fact that your stdin is not > in fact hooked up to the remote end -- your Ctrl-C is not terminating > the remote end, but the local Fabric session. So foreground programs > like tail -f will also not exit cleanly, in addition to > daemonized-but-not-detached processes which hold up the spawning shell > from exiting. > > Interaction like what you seem to have been expecting will be > available in Fabric 1.0 (though offhand I'm not sure whether we can > easily trap Ctrl-C itself, since it has special meaning for the local > end too -- but that's something that can be worked out). In the > meantime you'll have to write your Fab tasks in such a way that they > have some sort of halt condition not requiring interaction.
I haven't looked at the code for a while, but older versions at least trapped Ctrl-C aka. SIGINT with the signal module, to do connection clean-up. > > One "cheat" is to run something like e.g. > > local('ssh %s "tail -f /path/to/file"' % env.host_string, capture=False) > > which would use an "out-of-band" SSH connection in a local shell, > whose pipes *are* connected to your local ones. While the Ctrl-C > capturing Fabric does might still goof that up, it's worth a shot, and > will definitely work for other situations where Ctrl-C isn't the halt > method. > > Best, > Jeff > > On Mon, Jun 28, 2010 at 12:59 AM, Kenji Wellman <kenji.well...@gmail.com> > wrote: >> Hello, >> To demonstrate a problem I'm having I pasted some code below. On my server >> (Ubuntu 9.10 64 bit) when I run this code, and exit with CTRL C the "tail >> -f" process keeps running, and I have to manually send a SIGTERM signal to >> end it. >> >> Since the process is a non-daemonized process I would expect it to close >> like in regular ssh session after it is closed. Is there any way to get >> functionality like that? Running processes in the foreground is useful to me >> when I'm staging a development version of my site. >> >> from fabric.api import run, env >> >> env.hosts = ['localhost'] >> >> def test(): >> run('tail -f /var/log/syslog') >> >> >> _______________________________________________ >> Fab-user mailing list >> Fab-user@nongnu.org >> http://lists.nongnu.org/mailman/listinfo/fab-user >> >> > > > > -- > Jeff Forcier > Unix sysadmin; Python/Ruby developer > http://bitprophet.org > > _______________________________________________ > Fab-user mailing list > Fab-user@nongnu.org > http://lists.nongnu.org/mailman/listinfo/fab-user > -- Venlig hilsen / Kind regards, Christian Vest Hansen. _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user