From 23a957e783784182e89462e19a86aa5346d1e787 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 10 Jan 2020 15:22:26 +0100 Subject: [PATCH] [libcalamares] Chase API change (timeouts) - The new mount service needed adjustment for the independent change of timeouts: int -> chrono::seconds. --- src/libcalamares/partition/Mount.cpp | 5 +++-- src/libcalamares/partition/Sync.cpp | 6 +++--- src/libcalamares/utils/CalamaresUtilsSystem.h | 4 +--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libcalamares/partition/Mount.cpp b/src/libcalamares/partition/Mount.cpp index 08903b58c..91fcefff5 100644 --- a/src/libcalamares/partition/Mount.cpp +++ b/src/libcalamares/partition/Mount.cpp @@ -78,7 +78,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file } args << devicePath << mountPoint; - auto r = CalamaresUtils::System::runCommand( args, 10 ); + auto r = CalamaresUtils::System::runCommand( args, std::chrono::seconds( 10 ) ); sync(); return r.getExitCode(); } @@ -86,7 +86,8 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file int unmount( const QString& path, const QStringList& options ) { - auto r = CalamaresUtils::System::runCommand( QStringList { "umount" } << options << path, 10 ); + auto r + = CalamaresUtils::System::runCommand( QStringList { "umount" } << options << path, std::chrono::seconds( 10 ) ); sync(); return r.getExitCode(); } diff --git a/src/libcalamares/partition/Sync.cpp b/src/libcalamares/partition/Sync.cpp index e9b7ae149..c5e131cfa 100644 --- a/src/libcalamares/partition/Sync.cpp +++ b/src/libcalamares/partition/Sync.cpp @@ -24,13 +24,13 @@ void CalamaresUtils::Partition::sync() { - auto r = CalamaresUtils::System::runCommand( { "/sbin/udevadm", "settle" }, 10 ); + auto r = CalamaresUtils::System::runCommand( { "/sbin/udevadm", "settle" }, std::chrono::seconds( 10 ) ); if ( r.getExitCode() != 0 ) { cWarning() << "Could not settle disks."; - r.explainProcess( "udevadm", 10 ); + r.explainProcess( "udevadm", std::chrono::seconds( 10 ) ); } - CalamaresUtils::System::runCommand( { "/bin/sync" }, 10 ); + CalamaresUtils::System::runCommand( { "/bin/sync" }, std::chrono::seconds( 10 ) ); } diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index 476d6f4ce..6b46af31b 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -140,9 +140,7 @@ public: * Runs the given command-line @p args in the host in the current direcory * with no input, and the given @p timeoutSec for completion. */ - static inline ProcessResult runCommand( - const QStringList& args, - int timeoutSec ) + static inline ProcessResult runCommand( const QStringList& args, std::chrono::seconds timeoutSec ) { return runCommand( RunLocation::RunInHost, args, QString(), QString(), timeoutSec ); }