Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,22 @@ 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 ";
}
std::error_code ec;
auto curDir = current_path();
auto newDir = path("thread"s + std::to_string(id_));
create_directory(newDir, ec);
current_path(newDir, ec);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that any possible errors are silently ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, shall this work?

Suggested change
current_path(newDir, ec);
current_path(newDir, ec);
if (ec) {
throw cms::Exception("ExternalFailed")
<< "failed entering the working dir for process " << id_ << ": " << ec.message();
}

(Actually the previous code was following this example

auto newDir = path("thread"s + std::to_string(id));
create_directory(newDir, ec);
current_path(newDir, ec);
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about letting these functions to throw the exceptions? (i.e. remove the ec altogether, assuming the messages of those exceptions would be clear-enough)

pipe_ =
popen(("cmsExternalGenerator "s + verboseCommand + channel_.sharedMemoryName() + " " + channel_.uniqueID())
.c_str(),
"w");
current_path(curDir, ec);

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