Skip to content

Commit 04ba15b

Browse files
committed
workshop/Workplace: use return_cgroup only if it was created
1 parent f6fc4db commit 04ba15b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/workshop/Workplace.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,13 @@ WorkshopWorkplace::Start(EventLoop &event_loop, const WorkshopJob &job,
217217
logger(2, "job ", job.id, " (plan '", job.plan_name,
218218
"') started");
219219

220-
try {
221-
o->SetCgroup(EasyReceiveMessageWithOneFD(return_cgroup));
222-
} catch (...) {
223-
logger(1, "Failed to receive cgroup fd: ",
224-
std::current_exception());
220+
if (return_cgroup.IsDefined()) {
221+
try {
222+
o->SetCgroup(EasyReceiveMessageWithOneFD(return_cgroup));
223+
} catch (...) {
224+
logger(1, "Failed to receive cgroup fd: ",
225+
std::current_exception());
226+
}
225227
}
226228

227229
operators.push_back(*o.release());

0 commit comments

Comments
 (0)