_error->DumpErrors(std::cerr);
_error->RevertToStack();
+ // this is the dpkg status-fd, we need to keep it
+ _config->Set("APT::Keep-Fds::",fd[1]);
+
// Tell the progress that its starting and fork dpkg
d->progress->Start();
pid_t Child = ExecFork();
if (_config->FindB("DPkg::UseIoNice", false) == true)
ionice(Child);
+ // clear the Keep-Fd again
+ _config->Clear("APT::Keep-Fds",fd[1]);
+
// Wait for dpkg
int Status = 0;
#include <termios.h>
#include <sys/ioctl.h>
#include <sstream>
-
+#include <fcntl.h>
namespace APT {
namespace Progress {
void PackageManagerProgressFd::Start()
{
- _config->Set("APT::Keep-Fds::", OutStatusFd);
+ if(OutStatusFd <= 0)
+ return;
+
+ // FIXME: use SetCloseExec here once it taught about throwing
+ // exceptions instead of doing _exit(100) on failure
+ fcntl(OutStatusFd,F_SETFD,FD_CLOEXEC);
// send status information that we are about to fork dpkg
std::ostringstream status;
#include <apt-pkg/sptr.h>
#include <iostream>
-#include <fcntl.h>
#include <apti18n.h>
/*}}}*/
pkgPackageManager::OrderResult
pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress)
{
-// FIXME: port to new structure
-#if 0
- if(statusFd > 0)
- // FIXME: use SetCloseExec here once it taught about throwing
- // exceptions instead of doing _exit(100) on failure
- fcntl(statusFd,F_SETFD,FD_CLOEXEC);
-#endif
- bool goResult = Go(progress);
- if(goResult == false)
- return Failed;
-
- return Res;
+ bool goResult = Go(progress);
+ if(goResult == false)
+ return Failed;
+
+ return Res;
};
/*}}}*/
// PM::DoInstall - Does the installation /*{{{*/
if (_config->FindB("APT::Get::Simulate") == true)
{
pkgSimulate PM(Cache);
+
int status_fd = _config->FindI("APT::Status-Fd",-1);
APT::Progress::PackageManager *progress = NULL;
if (status_fd > 0)
progress = new APT::Progress::PackageManagerProgressFd(status_fd);
pkgPackageManager::OrderResult Res = PM.DoInstall(progress);
delete progress;
+
if (Res == pkgPackageManager::Failed)
return false;
if (Res != pkgPackageManager::Completed)
// FIXME: make this a factory
// select the right progress
int status_fd = _config->FindI("APT::Status-Fd",-1);
+
APT::Progress::PackageManager *progress = NULL;
if (status_fd > 0)
progress = new APT::Progress::PackageManagerProgressFd(status_fd);