Repository: Canop/bacon (language: rust)

Issue:
Bacon freezes when editing bacon.toml
Editing `bacon.toml` while running bacon (latest release or from `main`) causes bacon to freeze, and the only remedy I've found is to kill the process.

I'm on macOS 14.7.1.

From `bacon.log`:

```
12:28:55.121 [INFO] bacon::app: config watch event received
12:28:55.121 [DEBUG] bacon::app: requested action: Internal(ReloadConfig)
12:28:55.121 [INFO] bacon::watcher: notify event: Event { kind: Create(File), paths: ["/Users/ian/dev/koto/koto/bacon.toml"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
12:28:55.121 [INFO] bacon::watcher: ignorer.excludes_all_pathbufs(&we.paths) took 291ns
12:28:55.121 [DEBUG] bacon::watcher: at least one is included
12:28:55.121 [DEBUG] bacon::exec::executor: failed to send 'die' signal: sending on a disconnected channel
```


Discussion / hints:
Can you provide either the complete log or the config you're using ?
This seems to happen with any config file, e.g. in the `bacon` repo I can run `cargo run` and then edit `bacon.toml` to reproduce the hang. An empty config file triggers the issue.

Here's a full log: https://gist.github.com/irh/a86038cfdc6af0b9242ac6f2c9bd62a3

Does bacon freeze on you in other cases ? For example on <kbd>F5</kbd> ?
I haven't found any other ways to cause a freeze, and `F5`/`rerun` seems to work correctly.
I'm using Wezterm with Fish, but just checked and the same freeze happens in the default Terminal app, and when using `zsh`.
I have currently absolutely no idea regarding what happens and how to investigate.

Just in case, can you check when running a non cargo job, eg

```
[jobs.echo]
command = ["sh", "-c", "echo \"hello\""]
need_stdout = true

```
>Just in case, can you check when running a non cargo job

Yup same, it freezes.

> I have currently absolutely no idea regarding what happens and how to investigate.

Same, I'll see if I can get somewhere with a debugger.

Turns out to be the same hang as reported [here](https://github.com/notify-rs/notify/issues/208) in `notify`. 

The good news is that there's an easy workaround, I'll submit a PR shortly.

Fix patch:
diff --git a/src/watcher.rs b/src/watcher.rs
index 3e01513..c016fcf 100644
--- a/src/watcher.rs
+++ b/src/watcher.rs
@@ -22,8 +22,8 @@ use {
 
 /// A file watcher, providing a channel to receive notifications
 pub struct Watcher {
-    _notify_watcher: RecommendedWatcher,
     pub receiver: Receiver<()>,
+    _notify_watcher: RecommendedWatcher,
 }
 
 impl Watcher {
@@ -88,8 +88,8 @@ impl Watcher {
             }
         }
         Ok(Self {
-            _notify_watcher: notify_watcher,
             receiver,
+            _notify_watcher: notify_watcher,
         })
     }
 }


Test patch: