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
This commit is contained in:
Puneet Kaushik 2019-08-01 12:02:21 -07:00 committed by Facebook Github Bot
parent 29dba2fab3
commit 3878986e2c
3 changed files with 11 additions and 6 deletions

View File

@ -330,7 +330,10 @@ HgImporter::HgImporter(
cmd.push_back(folly::to<string>((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;

View File

@ -27,6 +27,7 @@ Subprocess::~Subprocess() {}
void Subprocess::createSubprocess(
const std::vector<string>& cmd,
const char* currentDir,
std::unique_ptr<Pipe> childInPipe,
std::unique_ptr<Pipe> 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);

View File

@ -22,6 +22,7 @@ class Subprocess {
void createSubprocess(
const std::vector<std::string>& cmd,
const char* currentDir = nullptr,
std::unique_ptr<Pipe> childInPipe = nullptr,
std::unique_ptr<Pipe> childOutPipe = nullptr);