From 46838bb4dc7d986a124b51c09c5a3c39f82522c0 Mon Sep 17 00:00:00 2001 From: Patrice Neff Date: Wed, 18 Jan 2012 09:42:04 +0100 Subject: [PATCH] Use subprocess `check_output` to run git This makes ghsync work on MS Windows. `commands` is only supported on Unix platforms. --- ghsync/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ghsync/core.py b/ghsync/core.py index f9e8786..f513bdc 100644 --- a/ghsync/core.py +++ b/ghsync/core.py @@ -23,14 +23,21 @@ Inspired by Gisty (http://github.com/swdyh/gisty). import os import sys -from commands import getoutput as cmd - from clint import args from clint.textui import puts, colored, indent import requests import json from github2.client import Github +try: + # check_output is new in 2.7. + from subprocess import check_output + def cmd(command): + return check_output(command, shell=True).strip() +except ImportError: + # commands is deprecated and doesn't work on Windows + from commands import getoutput as cmd + __author__ = 'Kenneth Reitz' __license__ = 'ISC'