forked from CargoSense/dart_sass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap sass execution in a bash script to address zombie processes (Car…
…goSense#1) * Simplify path functions * Add wrapper bash script to address zombie processes when --watch is given
- Loading branch information
Showing
3 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## v0.1.1 (Unreleased) | ||
|
||
* Add wrapper script to address zombie processes | ||
|
||
## v0.1.0 (2021-07-25) | ||
|
||
* First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script was taken from the Elixir Port guide. It is used to ensure | ||
# graceful termination of the `sass` process when it detects that stdin | ||
# has been closed. | ||
# Link: https://hexdocs.pm/elixir/Port.html#module-zombie-operating-system-processes | ||
# | ||
# This script is required until dart-sass supports listening on stdin and | ||
# gracefully terminating when stdin is closed. There is currently a PR for | ||
# this behaviour: https://github.com/sass/dart-sass/pull/1411 | ||
# | ||
# 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 |