process_io library
Process-control primitives that depend on dart:io + dart:ffi +
package:win32 and therefore do not work on the web. Import this in
addition to package:serverpod_shared/serverpod_shared.dart when you
need isProcessAlive / readProcessExecutable / InterProcessLock.
Kept out of the main barrel so dart2js / dart2wasm consumers (e.g.
browser code transitively reaching us via serverpod_service_client)
don't pull package:win32's external Pointer<...> types into the
compile graph.
Classes
- InterProcessLock
-
A cross-process, cross-isolate advisory lock backed by an atomically
created lock file (
O_CREAT | O_EXCL). - StaleLockPolicy
- Decides whether a waiter may reclaim an existing InterProcessLock file whose holder appears to have abandoned it.
Properties
- dartExecutablePath → String
-
The
dartexecutable inside getSdkPath - the real SDK binary, resolved through version-manager shims (puro/fvm/asdf). Spawn subprocesses with this rather than a PATHdartwhen they must receive signals: shell shims do not forward them.no setter -
Returns a path that is shared across all test files within a single
dart testinvocation, but unique per invocation.no setter
Functions
-
buildServerpodCli(
{required String buildRoot, String? serverpodHome}) → Future< String> -
Builds the serverpod repository's in-repo CLI once and returns the path
to the executable (
<buildRoot>/bundle/bin/serverpod_cli). -
findServerpodHome(
{Directory? from}) → String -
Locates the serverpod repository root: walks up from
from(defaults to the current directory) untiltools/serverpod_cliis found. -
getSdkPath(
) → String - Get the Dart SDK path.
-
isProcessAlive(
int pid) → bool -
Whether
pidcurrently refers to a live process on this host. -
readProcessExecutable(
int pid) → String? -
Absolute path to the executable image of the process at
pid, or null when the process is gone, inaccessible, or the host has no cheap way to resolve it.