Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

idea: [subprocess] Redirect stdout and stderr of subprocess to file #2037

@gau-nernst

Description

@gau-nernst

Problem Statement

This will be used by the Python engine. Since each Python model is spawned as a subprocess, ability to read stdout and stderr is invaluable for debugging.

Feature Idea

See above. I already have something working in my current Python engine PR. Just want to move parts of its to a separate PR so it's cleaner.

On MacOS/Linux, we will use file action https://linux.die.net/man/3/posix_spawn_file_actions_addopen

From my testing, there is no clean up to be done after process termination

On Windows, we can switch stdout/stderr handles in PROCESS_INFORMATION https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output (replacing Pipe handle with a File handle)

The file handles need to be closed after process termination.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions