aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-06-26 16:38:17 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-06-26 16:38:17 +0300
commite7d8789cb4106fb6ec9e3713cd71a209027ed8ff (patch)
tree63a6d1f02be6e55b312d782044f84f5a91b43cd0
parentad1de8623e8672c9d04103d400ead6fa250f59d8 (diff)
Sleep for 1 second after installing system/distribution packages in bpkg-build
-rw-r--r--bpkg/pkg-build.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 6a9ad7d..c230463 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -9,6 +9,11 @@
#include <sstream>
#include <iostream> // cout
+#ifndef _WIN32
+# include <thread> // this_thread::sleep_for()
+# include <chrono>
+#endif
+
#include <libbutl/standard-version.hxx>
#include <bpkg/package.hxx>
@@ -7752,6 +7757,15 @@ namespace bpkg
assert (sys_pkg_mgr && *sys_pkg_mgr != nullptr);
(*sys_pkg_mgr)->install (ps);
+
+ // Note that installing packages on POSIX systems may end up with
+ // asynchronous restart of some system services which, in particular,
+ // may result in the network short-term unavailability. Thus, let's
+ // pause for a while before fetching the source packages.
+ //
+#ifndef _WIN32
+ this_thread::sleep_for (chrono::seconds (1));
+#endif
}
}