Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11643 - in /trunk/zypper/src: Zypper.h main.cc utils/prompt.cc
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Sun, 09 Nov 2008 10:35:44 -0000
  • Message-id: <20081109103544.732E434686@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Sun Nov 9 11:35:44 2008
New Revision: 11643

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11643&view=rev
Log:
- exit immediately after ctrl+c in prompt (bnc #417997)

Modified:
trunk/zypper/src/Zypper.h
trunk/zypper/src/main.cc
trunk/zypper/src/utils/prompt.cc

Modified: trunk/zypper/src/Zypper.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/Zypper.h?rev=11643&r1=11642&r2=11643&view=diff
==============================================================================
--- trunk/zypper/src/Zypper.h (original)
+++ trunk/zypper/src/Zypper.h Sun Nov 9 11:35:44 2008
@@ -105,6 +105,7 @@
, commit_pkg_current(0)
, seen_verify_hint(false)
, action_rpm_download(false)
+ , waiting_for_input(false)
{}

std::list<zypp::RepoInfo> repos;
@@ -146,6 +147,9 @@

bool seen_verify_hint;
bool action_rpm_download;
+
+ //! \todo move this to a separate Status struct
+ bool waiting_for_input;
};

typedef zypp::shared_ptr<zypp::RepoManager> RepoManager_Ptr;

Modified: trunk/zypper/src/main.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/main.cc?rev=11643&r1=11642&r2=11643&view=diff
==============================================================================
--- trunk/zypper/src/main.cc (original)
+++ trunk/zypper/src/main.cc Sun Nov 9 11:35:44 2008
@@ -30,18 +30,26 @@
_("Use '%s' or enter '%s' to quit the shell."), "Ctrl+D", "quit") <<
endl;
::rl_reset_after_signal();
exit(ZYPPER_EXIT_ON_SIGNAL);
- //! \todo improve to drop to shell only
+ //! \todo improve to drop to shell only
}
else*/
{
- // translators: this will show up if you press ctrl+c twice outside of
zypper shell
+ // translators: this will show up if you press ctrl+c twice (but outside
of zypper shell)
cerr << endl << _("OK OK! Exiting immediately...") << endl;
zypper.cleanup();
exit(ZYPPER_EXIT_ON_SIGNAL);
}
}
+ else if (zypper.runtimeData().waiting_for_input)
+ {
+ zypper.cleanup();
+ exit(ZYPPER_EXIT_ON_SIGNAL);
+ }
else
+ {
+ //! \todo cerr << endl << _("Trying to exit gracefully...") << endl;
zypper.requestExit();
+ }
}


@@ -71,7 +79,7 @@
if (::signal(SIGINT, signal_handler) == SIG_ERR)
out.error("Failed to set SIGINT handler.");
if (::signal(SIGTERM, signal_handler) == SIG_ERR)
- out.error("Failed to set SIGTERM handler.");
+ out.error("Failed to set SIGTERM handler.");

try
{

Modified: trunk/zypper/src/utils/prompt.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/utils/prompt.cc?rev=11643&r1=11642&r2=11643&view=diff
==============================================================================
--- trunk/zypper/src/utils/prompt.cc (original)
+++ trunk/zypper/src/utils/prompt.cc Sun Nov 9 11:35:44 2008
@@ -188,6 +188,14 @@
return poptions.defaultOpt();
}

+ // set runtimeData().waiting_for_input flag while in this function
+ struct Bye
+ {
+ Bye(bool * flag) : _flag(flag) { *_flag = true; }
+ ~Bye() { *_flag = false; }
+ bool * _flag;
+ } say_goodbye(&zypper.runtimeData().waiting_for_input);
+
// open a terminal for input (bnc #436963)
ifstream stm("/dev/tty", ifstream::in);
// istream & stm = cin;

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages