The bounded-subprocess
module runs a subprocess with several bounds:
- The subprocess runs in a Linux session, so the process and all its children can be killed;
- The subprocess runs with a given timeout; and
- The parent captures a bounded amount of output from the subprocess and discards the rest.
Note that the subprocess is not isolated: it can use the network, the filesystem, or create new sessions.
python3 -m pip install bounded-subprocess
bounded-subprocess
is distributed under the terms of the MIT license.