diff options
author | Shawn O. Pearce <sop@google.com> | 2009-06-24 07:09:51 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-06-24 07:15:21 -0700 |
commit | 54fccd71fbdc60adf99b9a9bf4712c121d4312ba (patch) | |
tree | d51eb84344c0433e12335b1000ce3526b1368cf8 /editor.py | |
parent | fb5c8fd948dea211cd8f43477855de44c273a1bf (diff) | |
download | git-repo-54fccd71fbdc60adf99b9a9bf4712c121d4312ba.tar.gz |
Document any crashes from the user's text editorv1.6.8.4
Rather than failing with no information, display the child exit
status and the command line we tried to use to edit a text file.
There may be some useful information to help understand the crash.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'editor.py')
-rw-r--r-- | editor.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -76,8 +76,15 @@ least one of these before using this command.""" | |||
76 | os.close(fd) | 76 | os.close(fd) |
77 | fd = None | 77 | fd = None |
78 | 78 | ||
79 | if subprocess.Popen(editor + [path]).wait() != 0: | 79 | try: |
80 | raise EditorError() | 80 | rc = subprocess.Popen(editor + [path]).wait() |
81 | except OSError, e: | ||
82 | raise EditorError('editor failed, %s: %s %s' | ||
83 | % (str(e), cls._GetEditor(), path)) | ||
84 | if rc != 0: | ||
85 | raise EditorError('editor failed with exit status %d: %s %s' | ||
86 | % (rc, cls._GetEditor(), path)) | ||
87 | |||
81 | fd2 = open(path) | 88 | fd2 = open(path) |
82 | try: | 89 | try: |
83 | return fd2.read() | 90 | return fd2.read() |