Merge pull request #286 into master

a4b73cfe container: root: common: allow quotations in `Pluggable` arguments (Aaron Fiore)
This commit was merged in pull request #286.
This commit is contained in:
2026-01-29 10:08:32 -08:00

View File

@@ -26,8 +26,10 @@
#include <ctime>
#include <filesystem>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
@@ -619,11 +621,17 @@ class Pluggable
// Load pluggable file
::dfi::common::load(m_plug.path().absolute());
// Execute pluggable's loader
const std::string s{
// Prepare pluggable entry
const std::string entry{
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
+ "::" + m_plug.space().entry()};
::dfi::common::line(s + "::load(\"" + m_plug.args().load() + "\")");
// Allow quotations in loader argument
std::stringstream arg;
arg << std::quoted(m_plug.args().load());
// Execute pluggable's loader
::dfi::common::line(entry + "::load(" + arg.str() + ")");
return *this;
}
@@ -634,11 +642,17 @@ class Pluggable
//! \since docker-finance 1.1.0
const auto& unload() const
{
// Execute pluggable's unloader
const std::string s{
// Prepare pluggable entry
const std::string entry{
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
+ "::" + m_plug.space().entry()};
::dfi::common::line(s + "::unload(\"" + m_plug.args().unload() + "\")");
// Allow quotations in unloader argument
std::stringstream arg;
arg << std::quoted(m_plug.args().unload());
// Execute pluggable's unloader
::dfi::common::line(entry + "::unload(" + arg.str() + ")");
// Unload pluggable file
::dfi::common::unload(m_plug.path().absolute());