pub fn run() -> Result<()>Expand description
Bootstraps an embedded PostgreSQL instance, branching between root and unprivileged flows.
The bootstrap honours the following environment variables when present:
PG_RUNTIME_DIR: Overrides thePostgreSQLinstallation directory.PG_DATA_DIR: Overrides the data directory used for initialisation.PG_SUPERUSER: Sets the superuser account name.PG_PASSWORD: Supplies the superuser password.
When executed as root on Unix platforms the runtime drops privileges to the nobody user
and prepares the filesystem on that user’s behalf. Unprivileged executions reuse the current
user identity. The function returns a crate::Error describing failures encountered during
bootstrap.
This convenience wrapper discards the detailed TestBootstrapSettings. Call
bootstrap_for_tests to obtain the structured response for assertions.
§Examples
use pg_embedded_setup_unpriv::run;
fn main() -> Result<(), pg_embedded_setup_unpriv::Error> {
run()?;
Ok(())
}§Errors
Returns an error when bootstrap preparation fails or when subprocess orchestration cannot be configured.