Skip to content

CefProcessUtil

Header: cef_process_util.h
Category: System Utilities

Overview

Tasks, threads, parsers, streams, cookies, URL requests, scheme registration, and constant tables.

Free function: CefLaunchProcess

Source File: include/cef_process_util.h

Process / Thread Context: Browser process / TID_PROCESS_LAUNCHER thread only.

Purpose: Spawn a child process described by a CefCommandLine. Unix-specific: all parent file descriptors are closed in the child except stdin/stdout/stderr; if the first argument has no slash, PATH is searched (execvp semantics).

Usage Example

cpp
bool CefLaunchProcess(CefRefPtr<CefCommandLine> command_line);
cpp
class LaunchChildTask : public CefTask {
 public:
  void Execute() override {
    // Runs on TID_PROCESS_LAUNCHER.
    CefRefPtr<CefCommandLine> cmd = CefCommandLine::Create();
    cmd->SetProgram(L"/usr/bin/convert");
    cmd->AppendArgument(L"input.png");
    cmd->AppendArgument(L"output.jpg");
    if (!CefLaunchProcess(cmd)) LOG(ERROR) << "Failed to launch convert";
  }
  IMPLEMENT_REFCOUNTING(LaunchChildTask);
};

CefPostTask(TID_PROCESS_LAUNCHER, new LaunchChildTask);

Derived from the CEF C++ headers — © Marshall A. Greenblatt, Google Inc. & contributors (BSD-style license). Not an official CEF project.