Skip to content

Commit

Permalink
use poll() instead of returncode (presumably safer)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierverdier committed Aug 22, 2011
1 parent b255e21 commit a08ece8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
branch = gitsym.communicate()[0].strip()

if gitsym.returncode != 0:
if gitsym.poll():
import sys
sys.exit(0)

Expand Down Expand Up @@ -45,7 +45,7 @@
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.returncode != 0: # fallback to local
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.splitlines()
ahead = len([x for x in behead if x[0]=='>'])
Expand Down

0 comments on commit a08ece8

Please sign in to comment.