Skip to content

Commit 1fbc29c

Browse files
Using RunDirectory for commands instead for compiling and linking
1 parent 97a2b6a commit 1fbc29c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Src/runcpp2/CompilingLinking.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,15 @@ namespace
444444

445445
std::string scriptDirectory = ghc::filesystem::path(scriptPath).parent_path().string();
446446
std::string runcpp2ScriptDir = runcpp2::ProcessPath(scriptDirectory + "/.runcpp2");
447-
linkCommand = "cd " + runcpp2ScriptDir + " && " + linkCommand;
448447

449448
//Do Linking
450449
System2CommandInfo linkCommandInfo = {};
451450
linkCommandInfo.RedirectOutput = true;
451+
linkCommandInfo.RunDirectory = runcpp2ScriptDir.c_str();
452452
SYSTEM2_RESULT result = System2Run(linkCommand.c_str(), &linkCommandInfo);
453453

454454
ssLOG_INFO("running link command: " << linkCommand);
455+
ssLOG_INFO("in " << runcpp2ScriptDir);
455456

456457
if(result != SYSTEM2_RESULT_SUCCESS)
457458
{
@@ -514,17 +515,24 @@ namespace
514515
.string();
515516

516517
std::string runcpp2ScriptDir = runcpp2::ProcessPath(scriptDirectory + "/.runcpp2");
517-
std::string setupCommand = "cd " + runcpp2ScriptDir;
518+
std::string setupCommand;
518519

519520
const std::vector<std::string>& currentSetupSteps =
520521
*runcpp2::GetValueFromPlatformMap(profile.SetupSteps);
521522

522523
for(int i = 0; i < currentSetupSteps.size(); ++i)
523-
setupCommand += " && " + currentSetupSteps.at(i);
524+
{
525+
setupCommand += currentSetupSteps.at(i);
526+
if(i != currentSetupSteps.size() - 1)
527+
setupCommand += " && ";
528+
}
524529

525530
System2CommandInfo setupCommandInfo = {};
531+
setupCommandInfo.RunDirectory = runcpp2ScriptDir.c_str();
526532
setupCommandInfo.RedirectOutput = true;
533+
527534
ssLOG_INFO("running setup command: " << setupCommand);
535+
ssLOG_INFO("in " << runcpp2ScriptDir);
528536
SYSTEM2_RESULT result = System2Run(setupCommand.c_str(), &setupCommandInfo);
529537

530538
if(result != SYSTEM2_RESULT_SUCCESS)

0 commit comments

Comments
 (0)