diff --git a/lib/file_system/backends/fs_inotify.ex b/lib/file_system/backends/fs_inotify.ex index 3077a91cae07e741ab37215861cc5a6b41fd7355..9d4d9a485a1db42fd6f63b03cb848edda0a58dbc 100644 --- a/lib/file_system/backends/fs_inotify.ex +++ b/lib/file_system/backends/fs_inotify.ex @@ -106,9 +106,10 @@ defmodule FileSystem.Backends.FSInotify do {worker_pid, rest} = Keyword.pop(args, :worker_pid) case parse_options(rest) do {:ok, port_args} -> + bash_args = ['-c', to_charlist(executable_path()) ++ ' $0 $@ & PID=$!; read a; kill $PID'] port = Port.open( - {:spawn_executable, to_charlist(executable_path())}, - [:stream, :exit_status, {:line, 16384}, {:args, port_args}, {:cd, System.tmp_dir!()}] + {:spawn_executable, '/bin/sh'}, + [:stream, :exit_status, {:line, 16384}, {:args, bash_args ++ port_args}, {:cd, System.tmp_dir!()}] ) Process.link(port) Process.flag(:trap_exit, true) diff --git a/test/backends/fs_inotify_test.exs b/test/backends/fs_inotify_test.exs index 78b246cb58741d75f7a037789ed4f93d633b8729..a687aa4d5d57af95bda1fd572ef48d909689fda2 100644 --- a/test/backends/fs_inotify_test.exs +++ b/test/backends/fs_inotify_test.exs @@ -24,7 +24,7 @@ defmodule FileSystem.Backends.FSInotifyTest do assert {:ok, ['-e', 'modify', '-e', 'close_write', '-e', 'moved_to', '-e', 'create', '-e', 'delete', '-e', 'attrib', '--format', [37, 119, 1, 37, 101, 1, 37, 102], '--quiet', '-m', '/tmp']} == - parse_options(dirs: ["/tmp"], recursive: false, unsuppported: :options) + parse_options(dirs: ["/tmp"], recursive: false, unsupported: :options) end end