Switch uses of <unistd.h> to <folly/portability/Unistd.h>
[folly.git] / folly / Subprocess.cpp
index 8190c47063b64737b1a277ba579caab20b5cf3ae..c208de51eac8b53ec9cc680cd478edaccd513282 100644 (file)
@@ -26,8 +26,6 @@
 #include <fcntl.h>
 #include <poll.h>
 
-#include <unistd.h>
-
 #include <array>
 #include <algorithm>
 #include <system_error>
@@ -43,6 +41,7 @@
 #include <folly/String.h>
 #include <folly/io/Cursor.h>
 #include <folly/portability/Environment.h>
+#include <folly/portability/Unistd.h>
 
 constexpr int kExecFailure = 127;
 constexpr int kChildFailure = 126;
@@ -162,13 +161,13 @@ Subprocess::Options& Subprocess::Options::fd(int fd, int action) {
   return *this;
 }
 
+Subprocess::Subprocess() {}
+
 Subprocess::Subprocess(
     const std::vector<std::string>& argv,
     const Options& options,
     const char* executable,
-    const std::vector<std::string>* env)
-  : pid_(-1),
-    returnCode_(RV_NOT_STARTED) {
+    const std::vector<std::string>* env) {
   if (argv.empty()) {
     throw std::invalid_argument("argv must not be empty");
   }
@@ -179,9 +178,7 @@ Subprocess::Subprocess(
 Subprocess::Subprocess(
     const std::string& cmd,
     const Options& options,
-    const std::vector<std::string>* env)
-  : pid_(-1),
-    returnCode_(RV_NOT_STARTED) {
+    const std::vector<std::string>* env) {
   if (options.usePath_) {
     throw std::invalid_argument("usePath() not allowed when running in shell");
   }