Packages

Mix tasks for installing and invoking bun

Retired package: Renamed - This package has been renamed to 'bun' - https://github.com/crbelaus/bun

Current section

Files

Jump to
elixir_bun priv bun_launcher.sh
Raw

priv/bun_launcher.sh

#!/usr/bin/env bash
# This script has been taken from https://hexdocs.pm/elixir/main/Port.html#module-zombie-operating-system-processes
# Start the program in the background
exec "$@" &
pid1=$!
# Silence warnings from here on
exec >/dev/null 2>&1
# Read from stdin in the background and
# kill running program when stdin closes
exec 0<&0 $(
while read; do :; done
kill -KILL $pid1
) &
pid2=$!
# Clean up
wait $pid1
ret=$?
kill -KILL $pid2
exit $ret