Skip to main content

write_fd_launcher

Function write_fd_launcher 

Source
pub fn write_fd_launcher(dir: &Path) -> Result<PathBuf>
Expand description

Writes the fd-hook launcher, <dir>/fd-hook.sh, and returns its path.

The launcher is #!/bin/sh plus exec "$SHELLGAME_BIN" fd-hook "$@", mode 0700. exec keeps the redirected file descriptors of the caller (script.sh &> /dev/null), which is exactly what the fd evidence of the level inspects. It lives in the state directory rather than in the temporary directory, which may be mounted noexec.

dir is created when missing and made absolute. The file is replaced atomically, so game shells starting at the same time never see a partial file.

ยงErrors

Fails when the directory or the file cannot be created.