f / f/guardian

Crash when removing multiple files that are being watched

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Crystal
Stars
280
Forks
25
PR merge metrics
No merged PRs in 30d

Description

Hello,

Thank you for sharing guardian with everybody!

I've encountered a bug when several files that are being watched are removed between run intervals.

Steps to reproduce:

``` yaml
# .guardian.yml

---
files: ./*.txt
run: true
```

With above file, running guardian and proceed to create 3 empty files:

```
$ touch foo.txt bar.txt baz.txt
```

Guardian shows:

```
+ ./bar.txt
$ true
+ ./foo.txt
$ true
+ ./baz.txt
$ true
```

However on remove:

```
$ rm *.txt
```

```
- ./bar.txt
$ true
- ./foo.txt
Missing hash key: "./foo.txt" (KeyError)
[4493911] *CallStack::unwind:Array(Pointer(Void)) +87
[4493802] *CallStack#initialize:Array(Pointer(Void)) +10
[4493754] *CallStack::new:CallStack +42
[4605137] *KeyError +33
[4605073] *KeyError::new:KeyError +97
[4681949] *Hash(String, Array(String)) +141
[4681798] *Hash(String, Array(String)) +6
[4634092] *Guardian::Watcher#run_tasks:Array(String) +60
[4634003] *Guardian::Watcher#watch_changes:Hash(String, String) +2675
[4631271] *Guardian::Watcher#start_watching:NoReturn +215
[4619773] ???
[4618986] ???
[4455223] ???
[4463305] main +41
[139736944515648] __libc_start_main +240
[4450217] _start +41
[0] ???
```

I think is related to `file` key not existing inside `@runners` at the moment it reached that point.

Now sure how to proceed with the modification, which is why I'm opening an issue and not a pull request :wink:

Thank you :heart: :heart: :heart:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.