Documentation
¶
Overview ¶
Package sandbox runs image decoding in an isolated subprocess.
The caller's binary must call MaybeRunWorker() at the very top of main() so the child process can identify itself and apply OS-level restrictions before doing any work:
func main() {
termimage.MaybeRunWorker()
// ... normal startup
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode spawns a sandboxed worker subprocess to decode the image at path. Returns an NRGBA image whose pixels were produced inside the sandbox.
func DecodeBytes ¶ added in v0.1.0
DecodeBytes spawns a sandboxed worker subprocess to decode raw image bytes piped over stdin. Used for data: URIs and remote URLs where there is no on-disk file to grant access to.
func DecodeBytesContext ¶ added in v0.1.0
DecodeBytesContext is DecodeBytes with caller-supplied context.
func DecodeContext ¶
DecodeContext is Decode with caller-supplied context for cancellation.
func IsWorker ¶
func IsWorker() bool
IsWorker reports whether this process was spawned as a sandbox worker.
func MaybeRunWorker ¶
func MaybeRunWorker()
MaybeRunWorker checks if this process is a worker. If so, it applies OS-level sandbox restrictions, decodes the image from stdin, writes the raw pixel data to stdout, and exits. Call this at the start of main().
Types ¶
This section is empty.