readPidFileIfPresent function

String? readPidFileIfPresent(
  1. String path
)

Reads a PID file that may not be there.

Null means ABSENT — never written, or removed by the proxy between the check and the read. Every other FileSystemException is a filesystem this teardown does not understand, and it travels rather than reading as an empty process table.

Implementation

String? readPidFileIfPresent(String path) {
  try {
    return File(path).readAsStringSync();
  } on PathNotFoundException {
    return null;
  }
}