watcher icon indicating copy to clipboard operation
watcher copied to clipboard

The delete directory process exits

Open zdwork opened this issue 6 years ago • 10 comments

Don't want him to back out and help

zdwork avatar Sep 17 '19 10:09 zdwork

@zdwork sorry?

Akumzy avatar Sep 17 '19 10:09 Akumzy

Is there any good way to solve it? I did it with a gorouting, as long as we don't let the main process exit

zdwork avatar Sep 17 '19 10:09 zdwork

Sorry I still don't understand what you're trying to say.

Akumzy avatar Sep 17 '19 11:09 Akumzy

Don't let main exit.goroutine exec tail

zdwork avatar Sep 17 '19 11:09 zdwork

How do you delete a file without letting it exit

zdwork avatar Sep 17 '19 12:09 zdwork

You can remove the directory from watcher before deleting it.

Akumzy avatar Sep 17 '19 14:09 Akumzy

Excuse me, how do I do that

zdwork avatar Sep 17 '19 14:09 zdwork

w.RemoveRecursive(path)
//or
w.Remove(path)

Akumzy avatar Sep 17 '19 14:09 Akumzy

Sorry, what I just said is wrong, we all delete it first

zdwork avatar Sep 17 '19 15:09 zdwork

if name == err.(*os.PathError).Path { //w.Error <- ErrWatchedFileDeleted w.RemoveRecursive(name) }

howdy Is that ok?

zdwork avatar Sep 17 '19 15:09 zdwork