Skip to content

Commit f193032

Browse files
authored
Better character handling (#85)
1 parent 7c07f41 commit f193032

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/file_system/backends/fs_inotify.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ defmodule FileSystem.Backends.FSInotify do
125125

126126
port = Port.open(
127127
{:spawn_executable, '/bin/sh'},
128-
[:stream, :exit_status, {:line, 16384}, {:args, all_args}, {:cd, System.tmp_dir!()}]
128+
[:binary, :stream, :exit_status, {:line, 16384}, {:args, all_args}, {:cd, System.tmp_dir!()}]
129129
)
130130

131131
Process.link(port)
@@ -160,7 +160,7 @@ defmodule FileSystem.Backends.FSInotify do
160160

161161
def parse_line(line) do
162162
{path, flags} =
163-
case line |> to_string |> String.split(@sep_char, trim: true) do
163+
case String.split(line, @sep_char, trim: true) do
164164
[dir, flags, file] -> {Path.join(dir, file), flags}
165165
[path, flags] -> {path, flags}
166166
end

test/backends/fs_inotify_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ defmodule FileSystem.Backends.FSInotifyTest do
3434
end
3535

3636
describe "port line parse test" do
37-
defp to_port_line(list), do: list |> Enum.join(<<1>>) |> to_charlist
37+
defp to_port_line(list), do: list |> Enum.join(<<1>>)
3838

3939
test "dir write close" do
4040
assert {"/one/two/file", [:modified, :closed]} ==

0 commit comments

Comments
 (0)