anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / games / cataclysm-dda / glibc-2.39.diff
blobedc79ce76d79ce3155067d8c5fa68eb8e99ccb57
1 diff --git a/src/debug.cpp b/src/debug.cpp
2 index fa63a3b..1e8f554 100644
3 --- a/src/debug.cpp
4 +++ b/src/debug.cpp
5 @@ -1494,6 +1494,14 @@ std::string game_info::operating_system()
8 #if !defined(__CYGWIN__) && !defined (__ANDROID__) && ( defined (__linux__) || defined(unix) || defined(__unix__) || defined(__unix) || ( defined(__APPLE__) && defined(__MACH__) ) || defined(BSD) ) // linux; unix; MacOs; BSD
9 + //
10 +class FILEDeleter
12 + public:
13 + void operator()( FILE *f ) const noexcept {
14 + pclose( f );
15 + }
16 +};
17 /** Execute a command with the shell by using `popen()`.
18 * @param command The full command to execute.
19 * @note The output buffer is limited to 512 characters.
20 @@ -1504,7 +1512,7 @@ static std::string shell_exec( const std::string &command )
21 std::vector<char> buffer( 512 );
22 std::string output;
23 try {
24 - std::unique_ptr<FILE, decltype( &pclose )> pipe( popen( command.c_str(), "r" ), pclose );
25 + std::unique_ptr<FILE, FILEDeleter> pipe( popen( command.c_str(), "r" ) );
26 if( pipe ) {
27 while( fgets( buffer.data(), buffer.size(), pipe.get() ) != nullptr ) {
28 output += buffer.data();