[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Trouble receiving a stdout string from run
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] Trouble receiving a stdout string from run |
Date: |
Fri, 26 Jul 2013 10:49:03 -0700 |
Hi Neil,
Notice how Fabric didn't print out anything prefixed with 'out'
either, before returning control to your inspection code. That means
that Git really did not spit out any stdout/err when you ran it (and
that the repo on the "remote" end was not dirty). So that's the
problem - not run()'s behavior.
As to why that might be, my guess is if you're really using run() and
a host list of 'localhost', your home directory is another Git repo
that is *not* dirty, and perhaps you were expecting it to end up in
the repo you're running Fabric from (as if you'd used 'local()', for
example). The default cwd of a run() call is usually the connecting
user's home dir.
Best,
Jeff
On Wed, Jul 24, 2013 at 10:27 PM, Neil Clayton <address@hidden> wrote:
> Hi,
>
> I feel like I'm missing something obvious.
> The docs indicate that the output of a run() command will be a combination of
> stdout/err.
>
> I'm executing a 'git status --porcelain', on a repo with some changes.
> Nothing however is returned in the task.
>
> e.g:
> def _is_dirty(ignore_untracked_files=False):
> untracked_files = '--untracked-files=no' if ignore_untracked_files else ''
> outputFromStatus = run('git status {0}
> --porcelain'.format(untracked_files))
> print "Got status a {1}, '{0}', stdout: {2}, stderr:
> {3}".format(outputFromStatus, type(outputFromStatus),
> outputFromStatus.stdout, outputFromStatus.stderr)
> abort(blue('ra ra ra'))
> return outputFromStatus != ''
>
>
> And on the terminal I see:
> Fetching at folder:/Volumes/Development/Users/neil/Sites/swb/../store/
> [localhost] run: git status --porcelain
> Got status a <class 'fabric.operations._AttributeString'>, '', stdout: ,
> stderr:
>
> Fatal error: ra ra ra
>
> Aborting.
>
>
> Yet if I do this manually:
> (swb2)wisdom:store neil$ cd
> /Volumes/Development/Users/neil/Sites/swb/../store/
> (swb2)wisdom:store neil$ git-status --porcelain
> M .idea/workspace.xml
> M DataObjects/Config.php
> M pages/config.php
> (swb2)wisdom:store neil$
>
>
>
> What am I missing?
>
>
> Neil Clayton
>
>
>
>
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org