Skip to main content

Module direct

Module direct 

Source
Expand description

Direct-exec fast path for aube run.

Every package script normally goes through sh -c "<body>". /bin/sh does not exec in place — dash stays resident as the script’s parent — so a shell costs a whole extra process per invocation. For a body that is one plain command (tsc -p ., vitest run, node build.js) the shell contributes nothing but that process.

This module decides when a body can skip the shell. It is deliberately a strict allowlist rather than a tokenizer: a tokenizer splits words but says nothing about shell semantics, so it cannot tell us whether the shell was load-bearing. Anything we do not recognize with certainty falls back to sh -c, which is the pre-existing behavior. Every bail is a correctness win traded for a process we keep paying.

Functions§

direct_argv
Plan a direct exec of body against path, or None to use sh.
resolve_program
Find program on path, mirroring how the shell would resolve it.