How to get a basic direvent watcher working?

Viewed 33

I have read through the direvent documentation and am trying to get a simple watch working. Since I am having so much trouble with it, I am wondering if the issue has to do with the fact that the system I am using is nixos.

Here is the simple watcher file, watcher, I've created:

watcher {
  path ./dir;
  command "echo $file";
}

I run it in the foreground, so I can see the output, with direvent --foreground watcher. Once it's running, I create a file in dir, thus creating an event for it to respond to. However, it fails with the following output:

$ direvent --foreground watcher
direvent: [INFO] direvent 5.2 started
direvent: [ERROR] process 8552 failed with status 127
direvent: [ERROR] process 8555 failed with status 127
direvent: [ERROR] process 8557 failed with status 127

Since 127 usually means 'command not found', I tried specifying the path to echo, i.e. running this watcher instead:

watcher {
  path ./dir;
  command "/run/current-system/sw/bin/echo $file";
}

Then the output still gives an error, albeit a different one:

$ direvent --foreground watcher
direvent: [INFO] direvent 5.2 started
direvent: [ERROR] process 8645 failed with status 1
direvent: [ERROR] process 8651 failed with status 1
direvent: [ERROR] process 8652 failed with status 1

So the failure is now with status 1. I am not sure what to try next. I'm wondering if this issue is due to the fact that I am running nixos. Anyone know what I might try next to get direvent working?

1 Answers
Related