Struct postgresfixture::runtime::Runtime
source · pub struct Runtime {
pub bindir: Option<PathBuf>,
}Fields§
§bindir: Option<PathBuf>Path to the directory containing the pg_ctl executable and other
PostgreSQL binaries.
Can be omitted (i.e. None) to search PATH only.
Implementations§
source§impl Runtime
impl Runtime
sourcepub fn find<T: AsRef<OsStr> + ?Sized>(path: &T) -> Vec<Self> ⓘ
pub fn find<T: AsRef<OsStr> + ?Sized>(path: &T) -> Vec<Self> ⓘ
Find runtimes on the given path.
Parses input according to platform conventions for the PATH
environment variable. See env::split_paths for details.
sourcepub fn find_on_path() -> Vec<Self> ⓘ
pub fn find_on_path() -> Vec<Self> ⓘ
Find runtimes on PATH (environment variable).
pub fn new<P: AsRef<Path>>(bindir: P) -> Self
sourcepub fn version(&self) -> Result<Version, VersionError>
pub fn version(&self) -> Result<Version, VersionError>
Get the version number of PostgreSQL.
https://www.postgresql.org/support/versioning/ shows that version numbers are not SemVer compatible, so we have to parse them ourselves.
sourcepub fn execute<T: AsRef<OsStr>>(&self, program: T) -> Command
pub fn execute<T: AsRef<OsStr>>(&self, program: T) -> Command
Return a Command prepped to run the given program in this
PostgreSQL runtime.
let version = Runtime::default().execute("pg_ctl").arg("--version").output().unwrap();sourcepub fn command<T: AsRef<OsStr>>(&self, program: T) -> Command
pub fn command<T: AsRef<OsStr>>(&self, program: T) -> Command
Return a Command prepped to run the given program with this
PostgreSQL runtime at the front of PATH. This is very similar to
Self::execute except it does not qualify the given program name with
Self::bindir.
let version = Runtime::default().command("bash").arg("-c").arg("echo hello").output().unwrap();