Merge bitcoin/bitcoin#29910: refactor: Rename subprocess.hpp to follow our header name conventions

08f756bd37 Replace locale-dependent `std::strerror` with `SysErrorString` (Hennadii Stepanov)
d8e4ba4d05 refactor: Rename `subprocess.hpp` to follow our header name conventions (Hennadii Stepanov)

Pull request description:

  This PR renames the header `*.hpp` --> `*.h` and adjusts the header guard name, which makes it available for processing by linters.

  Fixed the following linter warning:
  ```
  The locale dependent function strerror(...) appears to be used:
  src/util/subprocess.h:    std::runtime_error( err_msg + ": " + std::strerror(err_code) )

  Unnecessary locale dependence can cause bugs that are very tricky to isolate and fix. Please avoid using locale-dependent functions if possible.

  Advice not applicable in this specific case? Add an exception by updating the ignore list in /bitcoin/test/lint/lint-locale-dependence.py
  ^---- failure generated from lint-locale-dependence.py
  ```

ACKs for top commit:
  TheCharlatan:
    ACK 08f756bd37

Tree-SHA512: 57a2f01c20eb9552481e428a4969bd59e9ada9f784fe1a45cb62aa9c9152c8e950d336854f45af0e2e5dc7c7b2a1fb216c8f832e3d6ccfb457ad71b6e423231e
This commit is contained in:
merge-script 2024-04-24 22:57:50 +08:00
commit 50729c0609
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
4 changed files with 9 additions and 7 deletions

View File

@ -320,7 +320,7 @@ BITCOIN_CORE_H = \
util/sock.h \
util/spanparsing.h \
util/string.h \
util/subprocess.hpp \
util/subprocess.h \
util/syserror.h \
util/task_runner.h \
util/thread.h \

View File

@ -12,7 +12,7 @@
#include <univalue.h>
#ifdef ENABLE_EXTERNAL_SIGNER
#include <util/subprocess.hpp>
#include <util/subprocess.h>
#endif // ENABLE_EXTERNAL_SIGNER
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)

View File

@ -11,7 +11,7 @@
#include <univalue.h>
#ifdef ENABLE_EXTERNAL_SIGNER
#include <util/subprocess.hpp>
#include <util/subprocess.h>
#endif // ENABLE_EXTERNAL_SIGNER
#include <boost/test/unit_test.hpp>

View File

@ -33,8 +33,10 @@ Documentation for C++ subprocessing library.
@version 1.0.0
*/
#ifndef SUBPROCESS_HPP
#define SUBPROCESS_HPP
#ifndef BITCOIN_UTIL_SUBPROCESS_H
#define BITCOIN_UTIL_SUBPROCESS_H
#include <util/syserror.h>
#include <algorithm>
#include <cassert>
@ -150,7 +152,7 @@ class OSError: public std::runtime_error
{
public:
OSError(const std::string& err_msg, int err_code):
std::runtime_error( err_msg + ": " + std::strerror(err_code) )
std::runtime_error(err_msg + ": " + SysErrorString(err_code))
{}
};
@ -1609,4 +1611,4 @@ namespace detail {
}
#endif // SUBPROCESS_HPP
#endif // BITCOIN_UTIL_SUBPROCESS_H