fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Catching errors in local calls


From: David
Subject: Re: [Fab-user] Catching errors in local calls
Date: Mon, 27 Sep 2010 10:08:51 +0900
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

Hi Jeff,

On 09/24/2010 10:22 PM, Jeff Forcier wrote:
Hi David,

On Fri, Sep 24, 2010 at 1:33 AM, David<address@hidden>  wrote:

I am using fabric for some simple test deployment scripts, and I have
encountered a slightly annoying behavior when local(some_cmd) fails. In that
case, the output of local is not displayed, making debugging the issue a bit
difficult.

I'm not sure what your exact code structure is (it's usually helpful
to include at least a small snippet when posting ;)) but if you're not
specifying capture=False, local() captures the output by default,
instead of displaying it:

My issue is not capturing the output, my issue is to show the output at all when there is a failure. Here is a somewhat contrived example

import random
from fabric.api import local

def foo():
    cmd = "ls"
    if random.randint(0, 1) == 0:
        cmd += "s"
    local(cmd)

The command will randomly fail. At that point, I don't see a way to show the output, as a failure in local abort the whole script. I do not want to see the output when the command succeeds.

cheers,

David



reply via email to

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