Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: build_image

Issue 3373003: Issue 6577: remove confirmation to delete output directory (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: detect non-interactive mode and delete output dir Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build_image
diff --git a/build_image b/build_image
index b4a6f1ac62add3154243086d7f6349c9acbafc23..6e2aa0e8a8c1a79f3c779fe63223a2765870af93 100755
--- a/build_image
+++ b/build_image
@@ -319,14 +319,21 @@ cleanup() {
delete_prompt() {
echo "An error occurred in your build so your latest output directory" \
"is invalid."
- read -p "Would you like to delete the output directory (y/N)? " SURE
- SURE="${SURE:0:1}" # Get just the first character.
+
+ # Only prompt if both stdin and stdout are a tty. If either is not a tty,
+ # then the user may not be present, so we shouldn't bother prompting.
+ if tty -s && tty -s <&1; then
+ read -p "Would you like to delete the output directory (y/N)? " SURE
+ SURE="${SURE:0:1}" # Get just the first character.
+ else
+ SURE="y"
+ echo "Running in non-interactive mode so deleting output directory."
+ fi
if [ "${SURE}" == "y" ] ; then
sudo rm -rf "${OUTPUT_DIR}"
echo "Deleted ${OUTPUT_DIR}"
else
- echo "Not deleting ${OUTPUT_DIR}. Note dev server updates will not work" \
- "until you successfully build another image or delete this directory"
+ echo "Not deleting ${OUTPUT_DIR}."
fi
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698