diff --git a/lib/dart_sass.ex b/lib/dart_sass.ex index 7c3b803..83113a3 100644 --- a/lib/dart_sass.ex +++ b/lib/dart_sass.ex @@ -134,12 +134,6 @@ defmodule DartSass do end end - # TODO: Remove when dart-sass will exit when stdin is closed. - @doc false - def script_path() do - Path.join(:code.priv_dir(:dart_sass), "dart_sass.bash") - end - @doc """ Returns the version of the Sass executable (or snapshot). @@ -183,21 +177,7 @@ defmodule DartSass do stderr_to_stdout: true ] - args = config_args ++ extra_args - path = bin_path() - - # TODO: Remove when dart-sass will exit when stdin is closed. - # Link: https://github.com/sass/dart-sass/pull/1411 - path = - if "--watch" in args and platform() != :windows do - [script_path() | path] - else - path - end - - path - |> cmd(args, opts) - |> elem(1) + cmd(bin_path(), config_args ++ extra_args, opts) |> elem(1) end @doc """ diff --git a/priv/dart_sass.bash b/priv/dart_sass.bash deleted file mode 100755 index 8c4de50..0000000 --- a/priv/dart_sass.bash +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 -r; do :; done - kill -KILL $pid1 -) & -pid2=$! - -# Clean up -wait $pid1 -ret=$? -kill -KILL $pid2 -exit $ret