5HT / fs

📁 FS: Windows, Linux, Mac Driver
https://fs.n2o.dev
Other
235 stars 69 forks source link

inotifywait with fdlink does not work #2

Closed Lol4t0 closed 9 years ago

Lol4t0 commented 9 years ago

I have 2 dev machines with Ubuntu 14.04. On the both inotifywait launched through fdlink crashes on start with the message {port_exit, 1}. Though it works when launched directly.

5HT commented 9 years ago

Maybe this is due to fdlink port dependency in sh https://github.com/synrc/sh/blob/master/src/sh.erl#L4 which includes fdlink in c_src already.

Lol4t0 commented 9 years ago

Well, I mean

Args = [find_executable(), "-m", "-e", "close_write", "-e", "moved_to", "-e", "create", "-r", Path1],
    erlang:open_port({spawn_executable, sh:fdlink_executable()},
        [stream, exit_status, {line, 16384}, {args, Args}, {cd, Cwd}]).

crashed with exit code 1 and

Args = ["-m", "-e", "close_write", "-e", "moved_to", "-e", "create", "-r", Path1],
    erlang:open_port({spawn_executable,find_executable()},
        [stream, exit_status, {line, 16384}, {args, Args}, {cd, Cwd}]).

works as intended.

I investigated a bit. Looks like erlang can't launch applications on the relative path on my system. If I replace

fdlink_executable() -> filename:join(code:priv_dir(sh), "fdlink").

with

fdlink_executable() -> filename:absname(filename:join(code:priv_dir(sh), "fdlink")).

in sh project (https://github.com/synrc/sh/blob/master/src/sh.erl#L4), fs starts working correctly

Could you please make a fix

5HT commented 9 years ago

https://github.com/synrc/sh/commit/364e00ad5b66c1d9a0723be5d49dd705cd000b97 Like that?

Lol4t0 commented 9 years ago

Yeah. Thanks. This way it workds. But don't forget to update tags for fs in rebar.config.

5HT commented 9 years ago

Done https://github.com/synrc/fs/commit/3f5b232076ec900155270d7e9279007ef69d4837

Lol4t0 commented 9 years ago

Fixed.