Skip to content

Commit c2678bd

Browse files
committed
cover boost::process by the try...catch
1 parent 15e85ed commit c2678bd

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

IntelPresentMon/AppCef/source/winmain.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -231,26 +231,27 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
231231
// configure the logging system (partially based on command line options)
232232
ConfigureLogging();
233233

234-
// service-as-child handling
235-
std::optional<boost::process::child> childSvc;
236-
if (!opt.cefType && opt.svcAsChild) {
237-
using namespace std::literals;
238-
namespace bp = boost::process;
239-
240-
childSvc.emplace("PresentMonService.exe"s,
241-
"--control-pipe"s, *opt.controlPipe,
242-
"--nsm-prefix"s, "pm-frame-nsm"s,
243-
"--intro-nsm"s, *opt.shmName,
244-
"--etw-session-name"s, *opt.etwSessionName);
245-
246-
if (!pmon::util::win::WaitForNamedPipe(*opt.controlPipe, 1500)) {
247-
pmlog_error(L"timeout waiting for child service control pipe to go online");
248-
return -1;
234+
try {
235+
// service-as-child handling
236+
std::optional<boost::process::child> childSvc;
237+
if (!opt.cefType && opt.svcAsChild) {
238+
using namespace std::literals;
239+
namespace bp = boost::process;
240+
241+
childSvc.emplace("PresentMonService.exe"s,
242+
"--control-pipe"s, *opt.controlPipe,
243+
"--nsm-prefix"s, "pm-frame-nsm"s,
244+
"--intro-nsm"s, *opt.shmName,
245+
"--etw-session-name"s, *opt.etwSessionName);
246+
247+
if (!pmon::util::win::WaitForNamedPipe(*opt.controlPipe, 1500)) {
248+
pmlog_error(L"timeout waiting for child service control pipe to go online");
249+
return -1;
250+
}
249251
}
250-
}
251252

252-
using namespace client;
253-
try {
253+
using namespace client;
254+
// cef process constellation fork control
254255
CefMainArgs main_args{ hInstance };
255256
CefRefPtr<ccef::NanoCefProcessHandler> app = new ccef::NanoCefProcessHandler{};
256257

0 commit comments

Comments
 (0)