Chromium Code Reviews| Index: git_cl/git_cl.py |
| =================================================================== |
| --- git_cl/git_cl.py (revision 78071) |
| +++ git_cl/git_cl.py (working copy) |
| @@ -711,15 +711,21 @@ |
| fileobj.close() |
| # Open up the default editor in the system to get the CL description. |
| - ret = subprocess.call(editor + ' ' + filename, shell=True) |
| - if ret != 0: |
| + try: |
| + cmd = '%s %s' % (GetEditor(), filename) |
|
TVL
2011/03/14 20:53:38
um, GetEditor() doesn't exist in here, and there i
Mohamed Mansour
2011/03/14 20:58:17
Done.
|
| + if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': |
| + # Msysgit requires the usage of 'env' to be present. |
| + cmd = 'env ' + cmd |
| + # shell=True to allow the shell to handle all forms of quotes in $EDITOR. |
| + subprocess.check_call(cmd, shell=True) |
| + fileobj = open(filename) |
| + text = fileobj.read() |
| + fileobj.close() |
| + finally: |
| os.remove(filename) |
| - return |
| - fileobj = open(filename) |
| - text = fileobj.read() |
| - fileobj.close() |
| - os.remove(filename) |
| + if not result: |
| + return 0 |
| stripcomment_re = re.compile(r'^#.*$', re.MULTILINE) |
| return stripcomment_re.sub('', text).strip() |