1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

LibC: Implement popen() and pclose().

I feel reasonably confident that I might have gotten these right. :^)
This commit is contained in:
Andreas Kling 2019-06-03 19:52:31 +02:00
parent e92fe52031
commit ccc6e69a29
3 changed files with 89 additions and 5 deletions

26
AK/ValueRestorer.h Normal file
View file

@ -0,0 +1,26 @@
#pragma once
namespace AK {
template<typename T>
class ValueRestorer {
public:
ValueRestorer(T& variable)
: m_variable(variable)
, m_saved_value(variable)
{
}
~ValueRestorer()
{
m_variable = m_saved_value;
}
private:
T& m_variable;
T m_saved_value;
};
}
using AK::ValueRestorer;