Skip to content

Crash when removing multiple files that are being watched #4

@luislavena

Description

@luislavena

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:

# .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<CallStack>:Array(Pointer(Void)) +10
[4493754] *CallStack::new:CallStack +42
[4605137] *KeyError +33
[4605073] *KeyError::new<String>:KeyError +97
[4681949] *Hash(String, Array(String)) +141
[4681798] *Hash(String, Array(String)) +6
[4634092] *Guardian::Watcher#run_tasks<Guardian::Watcher, String>:Array(String) +60
[4634003] *Guardian::Watcher#watch_changes<Guardian::Watcher>:Hash(String, String) +2675
[4631271] *Guardian::Watcher#start_watching<Guardian::Watcher>: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 😉

Thank you ❤️ ❤️ ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions