Files
StarPilot/openpilot/tools/replay/py_process.h
T
firestar5683 e9dd458699 Replay
Provide route replay, log migration and recorded vehicle fixtures for regression checks.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
Co-authored-by: YassineYousfi <yyousfi1@binghamton.edu>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
2026-10-14 20:02:39 -05:00

22 lines
884 B
C++

#pragma once
#include <atomic>
#include <functional>
#include <string>
#include <vector>
namespace PyProcess {
// Called with each line of the child's stderr (newline-terminated).
using StderrLineCallback = std::function<void(const char *line)>;
// Run a Python module (`python3 -m <module> <args...>`) and capture stdout.
// Stderr lines are passed to stderr_line_cb if set, otherwise through to the parent's stderr.
// If trim is true (default), trailing newlines are removed from the returned stdout content.
// Returns empty string on failure. If abort is signaled, kills the child process.
std::string runModule(const std::string &module, const std::vector<std::string> &args,
std::atomic<bool> *abort = nullptr, bool trim = true,
const StderrLineCallback &stderr_line_cb = nullptr, int source_fd = -1);
} // namespace PyProcess