From 3878986e2ce574442279d32b0562d7eb8ded818d Mon Sep 17 00:00:00 2001 From: Puneet Kaushik Date: Thu, 1 Aug 2019 12:02:21 -0700 Subject: [PATCH] Run hg debugedenimporthelper with CWD as repository Summary: hg debugedenimporthelper should either have the repo path as argument or the current working directory should be inside a repo. Setting the current working directory for the process. Reviewed By: strager Differential Revision: D16565042 fbshipit-source-id: d6e826bebf58fd58f5250e6c477849ca147628c8 --- eden/fs/store/hg/HgImporter.cpp | 5 ++++- eden/fs/win/utils/Subprocess.cpp | 11 ++++++----- eden/fs/win/utils/Subprocess.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/eden/fs/store/hg/HgImporter.cpp b/eden/fs/store/hg/HgImporter.cpp index c0be6e0366..276d3e51d2 100644 --- a/eden/fs/store/hg/HgImporter.cpp +++ b/eden/fs/store/hg/HgImporter.cpp @@ -330,7 +330,10 @@ HgImporter::HgImporter( cmd.push_back(folly::to((int)childInPipe->readHandle)); helper_.createSubprocess( - cmd, std::move(childInPipe), std::move(childOutPipe)); + cmd, + repoPath.value().str().c_str(), + std::move(childInPipe), + std::move(childOutPipe)); helperIn_ = helper_.childInPipe_->writeHandle; helperOut_ = helper_.childOutPipe_->readHandle; diff --git a/eden/fs/win/utils/Subprocess.cpp b/eden/fs/win/utils/Subprocess.cpp index 18a7c5262a..f8ee288864 100644 --- a/eden/fs/win/utils/Subprocess.cpp +++ b/eden/fs/win/utils/Subprocess.cpp @@ -27,6 +27,7 @@ Subprocess::~Subprocess() {} void Subprocess::createSubprocess( const std::vector& cmd, + const char* currentDir, std::unique_ptr childInPipe, std::unique_ptr childOutPipe) { childInPipe_ = std::move(childInPipe); @@ -48,14 +49,14 @@ void Subprocess::createSubprocess( XLOG(DBG1) << "Creating the process: " << cmdToProcess.c_str() << std::endl; status = CreateProcessA( - NULL, + nullptr, (LPSTR)cmdToProcess.c_str(), - NULL, - NULL, + nullptr, + nullptr, TRUE, // inherit the handles 0, - NULL, - NULL, + nullptr, + currentDir, &startupInfo, &procInfo); diff --git a/eden/fs/win/utils/Subprocess.h b/eden/fs/win/utils/Subprocess.h index bd1eba7161..e49b1981f6 100644 --- a/eden/fs/win/utils/Subprocess.h +++ b/eden/fs/win/utils/Subprocess.h @@ -22,6 +22,7 @@ class Subprocess { void createSubprocess( const std::vector& cmd, + const char* currentDir = nullptr, std::unique_ptr childInPipe = nullptr, std::unique_ptr childOutPipe = nullptr);