Skip to content

Commit

Permalink
Merge pull request #35253 from Dr15Jones/current_path_externalGenerator
Browse files Browse the repository at this point in the history
Change current path in cmsExternalGenerator not cmsRun
  • Loading branch information
cmsbuild authored Sep 14, 2021
2 parents 52ff3db + 78474b2 commit 86094ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 8 additions & 0 deletions GeneratorInterface/Core/bin/externalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>
#include <thread>
#include <memory>
#include <filesystem>

#include "FWCore/TestProcessor/interface/TestProcessor.h"

Expand Down Expand Up @@ -137,6 +138,13 @@ int main(int argc, char* argv[]) {
return 1;
}

using namespace std::string_literals;
using namespace std::filesystem;

auto newDir = path("thread"s + vm[kUniqueIDOpt].as<std::string>());
create_directory(newDir);
current_path(newDir);

WorkerMonitorThread monitorThread;

monitorThread.startThread();
Expand Down
7 changes: 0 additions & 7 deletions GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,15 @@ namespace externalgen {

channel_.setupWorker([&]() {
using namespace std::string_literals;
using namespace std::filesystem;
edm::LogSystem("ExternalProcess") << id_ << " starting external process \n";
std::string verboseCommand;
if (verbose) {
verboseCommand = "--verbose ";
}
auto curDir = current_path();
auto newDir = path("thread"s + std::to_string(id_));
create_directory(newDir);
current_path(newDir);
pipe_ =
popen(("cmsExternalGenerator "s + verboseCommand + channel_.sharedMemoryName() + " " + channel_.uniqueID())
.c_str(),
"w");
current_path(curDir);

if (nullptr == pipe_) {
abort();
}
Expand Down

0 comments on commit 86094ed

Please sign in to comment.