Stop using timeout(1)
steam-runtime-tools currently runs several diagnostic tools under timeout(1)
, which is a bit of a mess for a couple of reasons:
- Canonical's Steam Snap packaging runs under a restrictive AppArmor profile that doesn't allow
execve()
of/usr/bin/timeout
- Starting a new process is relatively expensive, particularly in an emulation environment like FEX-Emu
Ideally we could do this more like:
- create a new GMainContext
- set it as the thread-default main context
- attach I/O and child process sources to that main context
- also attach a timeout source to that main context
- iterate the main context until the process has exited and the stdout/stderr fds have reached EOF
- pop thread-default main context
- sort out results
- return to caller
@smcv has most of an implementation of this.
This would be easier with GSubprocess and GTask, but those need GLib 2.40.