environmentOverlay method

Map<String, String> environmentOverlay()

The env/PATH overlay for a bash tool spawn: bashGuardPidsEnv plus the shim dir at the head of PATH (in front of any inherited or widened PATH, so the shims always win).

Implementation

Map<String, String> environmentOverlay() {
  final overlay = <String, String>{bashGuardPidsEnv: protectedPids.join(' ')};
  final dir = shimDir;
  if (dir != null) {
    overlay[bashGuardShimDirEnv] = dir;
  }
  return overlay;
}