, commit_pkg_current(0)
, seen_verify_hint(false)
, action_rpm_download(false)
+ , waiting_for_input(false)
{}
std::list<zypp::RepoInfo> repos;
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;
_("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();
+ }
}
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
{
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;