3
3
#
4
4
# This module is part of GitPython and is released under
5
5
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6
- from __future__ import unicode_literals
7
-
8
6
import contextlib
9
7
from functools import wraps
10
8
import getpass
11
9
import logging
12
10
import os
13
11
import platform
12
+ import subprocess
14
13
import re
15
14
import shutil
16
15
import stat
17
16
import time
18
- from unittest .case import SkipTest
17
+ try :
18
+ from unittest import SkipTest
19
+ except ImportError :
20
+ from unittest2 import SkipTest
19
21
20
22
from gitdb .util import (# NOQA @IgnorePep8
21
23
make_sha ,
@@ -303,7 +305,7 @@ def is_cygwin_git(git_executable):
303
305
if not is_win :
304
306
return False
305
307
306
- from subprocess import check_output
308
+ # from subprocess import check_output
307
309
308
310
is_cygwin = _is_cygwin_cache .get (git_executable )
309
311
if is_cygwin is None :
@@ -316,8 +318,11 @@ def is_cygwin_git(git_executable):
316
318
317
319
## Just a name given, not a real path.
318
320
uname_cmd = osp .join (git_dir , 'uname' )
319
- uname = check_output (uname_cmd , universal_newlines = True )
320
- is_cygwin = 'CYGWIN' in uname
321
+ process = subprocess .Popen ([uname_cmd ], stdout = subprocess .PIPE ,
322
+ universal_newlines = True )
323
+ uname_out , _ = process .communicate ()
324
+ #retcode = process.poll()
325
+ is_cygwin = 'CYGWIN' in uname_out
321
326
except Exception as ex :
322
327
log .debug ('Failed checking if running in CYGWIN due to: %r' , ex )
323
328
_is_cygwin_cache [git_executable ] = is_cygwin
@@ -940,6 +945,7 @@ class NullHandler(logging.Handler):
940
945
def emit (self , record ):
941
946
pass
942
947
948
+
943
949
# In Python 2.6, there is no NullHandler yet. Let's monkey-patch it for a workaround.
944
950
if not hasattr (logging , 'NullHandler' ):
945
951
logging .NullHandler = NullHandler
0 commit comments