Fixed a small flaw: pipe stream did not report source in errors

This commit is contained in:
Matthias Koefferlein 2024-02-28 22:41:09 +01:00
parent 9a52095dd0
commit 012447c31b
2 changed files with 5 additions and 6 deletions

View File

@ -1334,11 +1334,11 @@ OutputPipe::write (const char *b, size_t n)
// ---------------------------------------------------------------
// InputPipe delegate implementation
InputPipe::InputPipe (const std::string &path)
InputPipe::InputPipe (const std::string &source)
: m_file (NULL)
{
m_source = path;
m_file = popen (tl::string_to_system (path).c_str (), "r");
m_source = source;
m_file = popen (tl::string_to_system (source).c_str (), "r");
if (m_file == NULL) {
throw FilePOpenErrorException (m_source, errno);
}

View File

@ -313,7 +313,7 @@ public:
* @param cmd The command to execute
* @param read True, if the file should be read, false on write.
*/
InputPipe (const std::string &path);
InputPipe (const std::string &source);
/**
* @brief Close the pipe
@ -348,8 +348,7 @@ public:
*/
virtual std::string source () const
{
// No source (in the sense of a file name) is available ..
return std::string ();
return m_source;
}
virtual std::string absolute_path () const