rgpycrumbs.run.jupyter¶
Attributes¶
Functions¶
|
Kill proc with the processes it started, then reap proc. |
|
Internal: run command and stream stdout/stderr live to current stdout. |
|
Helper wrapper to run commands, stream output, and exit script/notebook |
Module Contents¶
- rgpycrumbs.run.jupyter._kill_process_group(proc: subprocess.Popen) None[source]¶
Kill proc with the processes it started, then reap proc.
- rgpycrumbs.run.jupyter._run_command_live(cmd: str | list[str], *, check: bool = True, timeout: float | None = None, capture: bool = False, encoding: str = 'utf-8') subprocess.CompletedProcess[source]¶
Internal: run command and stream stdout/stderr live to current stdout. If capture=True, also collect combined output and return it in CompletedProcess.stdout.
timeout bounds the whole run, including stretches where the child writes nothing and output that processes it started keep open.
- rgpycrumbs.run.jupyter.run_command_or_exit(cmd: str | list[str], capture: bool = False, timeout: float | None = None) subprocess.CompletedProcess[source]¶
Helper wrapper to run commands, stream output, and exit script/notebook cleanly on failure so sphinx-gallery sees the errors appropriately.
timeout is in seconds and bounds the whole command, including output that processes it started keep open. At the deadline the command and the processes it started are killed, and the script exits with status 124. The default,
None, waits without a bound.On POSIX the command runs in its own session, so Ctrl-C in a terminal interrupts only the helper, which then kills the command and the processes it started.
Added in version 0.1.0.
Changed in version 1.14.0: timeout stops a running command and the processes it started. It used to start only after the command closed its output, so it never stopped a command that kept its output open. The default is
Noneinstead of 300, so commands that ran past 300 seconds still finish. The command runs in its own session.