diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2015-07-20 13:23:28 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2015-07-20 13:23:28 -0230 |
commit | 45ccb286ef1d1ed610f5e158a843b9927f861cc4 (patch) | |
tree | 3e27d4bd8c0de76adb74df52933d1e6bd7dcbda8 /cpp | |
parent | ICE-6661 Cannot build Ice with -Os on Ubuntu 15.04 (diff) | |
download | ice-45ccb286ef1d1ed610f5e158a843b9927f861cc4.tar.bz2 ice-45ccb286ef1d1ed610f5e158a843b9927f861cc4.tar.xz ice-45ccb286ef1d1ed610f5e158a843b9927f861cc4.zip |
ICE-6316 confirm abort of icepatch2client
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/IcePatch2/Client.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp index 8ef166ab0d0..8c39f64f1e8 100644 --- a/cpp/src/IcePatch2/Client.cpp +++ b/cpp/src/IcePatch2/Client.cpp @@ -176,6 +176,10 @@ private: pressed = true; _getch(); } + if(pressed) + { + pressed = confirmAbort(); + } return pressed; } @@ -192,7 +196,7 @@ private: term.c_cc[VTIME] = 0; term.c_cc[VMIN] = 1; tcsetattr(0, TCSANOW, &term); - + int flags = _savedFlags; flags |= O_NONBLOCK; fcntl(0, F_SETFL, flags); @@ -206,6 +210,10 @@ private: { pressed = true; } + if(pressed) + { + pressed = confirmAbort(); + } return pressed; } @@ -215,6 +223,32 @@ private: #endif + bool + confirmAbort() + { +#ifndef _WIN32 + if(!_block) + { + tcsetattr(0, TCSANOW, &_savedTerm); + fcntl(0, F_SETFL, _savedFlags); + _block = true; + } +#endif + string answer; + do + { + cout << "\nConfirm abort? (Y/N)" << endl; + cin >> answer; + answer = IceUtilInternal::toLower(answer); + if(answer == "n") + { + return false; + } + } + while(answer != "y"); + return true; + } + string _lastProgress; bool _pressAnyKeyMessage; }; @@ -239,7 +273,7 @@ Client::run(int argc, char* argv[]) opts.addOpt("h", "help"); opts.addOpt("v", "version"); opts.addOpt("t", "thorough"); - + vector<string> args; try { |