diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-29 17:26:00 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-29 17:26:00 +0000 |
commit | f6c5f75b3cb173be1a45032f8fc78b02cded9cc8 (patch) | |
tree | b515abca0a160c75a7f14c1f5a533ea5f29fe5a4 /PRESUBMIT.py | |
parent | e80c2bc80e2939936744a9001ba2f24e6f97903d (diff) |
Display prompt for caution only if it is an interactive shell.
Created to fix https://code.google.com/p/skia/issues/detail?id=1197 : Skia Commit Queue quits if the tree is in Caution.
(SkipBuildbotRuns)
Review URL: https://codereview.chromium.org/13325002
git-svn-id: http://skia.googlecode.com/svn/trunk@8446 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r-- | PRESUBMIT.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index ddac74a5b4..323bba9074 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -9,6 +9,9 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into gcl. """ +import os +import sys + def _CheckChangeHasEol(input_api, output_api, source_file_filter=None): """Checks that files end with atleast one \n (LF).""" @@ -67,7 +70,11 @@ def _CheckTreeStatus(input_api, output_api, json_url): connection = input_api.urllib2.urlopen(json_url) status = input_api.json.loads(connection.read()) connection.close() - if 'caution' in status['message'].lower(): + if ('caution' in status['message'].lower() and + os.isatty(sys.stdout.fileno())): + # Display a prompt only if we are in an interactive shell. Without this + # check the commit queue behaves incorrectly because it considers + # prompts to be failures. short_text = 'Tree state is: ' + status['general_state'] long_text = status['message'] + '\n' + json_url tree_status_results.append( |