Fix GlogFormatterTest on Windows
[folly.git] / folly / Subprocess.h
index 01e6d2c07ab148b833a2c2915fa0d67b4e2f6550..ea2a062afd16dd12acbc97ebfefa708c52d6070c 100644 (file)
@@ -209,7 +209,10 @@ class ProcessReturnCode {
 /**
  * Base exception thrown by the Subprocess methods.
  */
-class SubprocessError : public std::exception {};
+class SubprocessError : public std::runtime_error {
+ public:
+  using std::runtime_error::runtime_error;
+};
 
 /**
  * Exception thrown by *Checked methods of Subprocess.
@@ -217,12 +220,10 @@ class SubprocessError : public std::exception {};
 class CalledProcessError : public SubprocessError {
  public:
   explicit CalledProcessError(ProcessReturnCode rc);
-  ~CalledProcessError() throw() = default;
-  const char* what() const throw() override { return what_.c_str(); }
+  ~CalledProcessError() throw() override = default;
   ProcessReturnCode returnCode() const { return returnCode_; }
  private:
   ProcessReturnCode returnCode_;
-  std::string what_;
 };
 
 /**
@@ -231,13 +232,11 @@ class CalledProcessError : public SubprocessError {
 class SubprocessSpawnError : public SubprocessError {
  public:
   SubprocessSpawnError(const char* executable, int errCode, int errnoValue);
-  ~SubprocessSpawnError() throw() = default;
-  const char* what() const throw() override { return what_.c_str(); }
+  ~SubprocessSpawnError() throw() override = default;
   int errnoValue() const { return errnoValue_; }
 
  private:
   int errnoValue_;
-  std::string what_;
 };
 
 /**