Skip to content

Ctrl+C and SIGTERM does nothing when --watch flag is used #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rmmcnulty9 opened this issue Aug 28, 2018 · 11 comments
Closed

Ctrl+C and SIGTERM does nothing when --watch flag is used #132

rmmcnulty9 opened this issue Aug 28, 2018 · 11 comments
Labels
area: watcher Changes related to the Taskfile watcher.

Comments

@rmmcnulty9
Copy link

Hello, I am trying to use the --watch for one of my tasks but I can not stop task when I am done. I have to kill -9 task. Am I missing something?

@andreynering
Copy link
Member

Hi @rmmcnulty9, thanks for reporting this bug!

I plan to take a look at it soon

@andreynering
Copy link
Member

@rmmcnulty9 Can you tell me what operating system you're using?

@grzegorz-zur
Copy link

grzegorz-zur commented Sep 4, 2018

You need to range over signals in this function

go func() {

I can send pull request later.

@grzegorz-zur
Copy link

There is also no call to context.Done method anywhere in the code.

@andreynering
Copy link
Member

@grzegorz-zur Done os called on the sh lib. See:

https://github.com/mvdan/sh/blob/3a244a89e2e520d2777e94693d51bef800761879/interp/module.go#L81

Let me know if you need help

@rmmcnulty9
Copy link
Author

Hello @andreynering , sorry for the slow reply. I am using Ubuntu 18.04
HTH

@grzegorz-zur
Copy link

@andreynering It seems that in the file watch.go new contexts are created. The context used in signal handler is not the one used in watch mode.

@andreynering
Copy link
Member

@rmmcnulty9 @grzegorz-zur Thanks, I was able to identify the problem: there was no break or return inside the infinite loop, so even if the context was cancelled, the program would not exit.

I fixed it by having a different signal handling to explicitly close the watcher.

@andreynering
Copy link
Member

Let me know if you still experience problems after this fix.

@andreynering
Copy link
Member

v2.1.1 is released with this fix

@rmmcnulty9
Copy link
Author

Thanks for the quick turn around. I am very anxious to drop make for task 😄

@andreynering andreynering added the area: watcher Changes related to the Taskfile watcher. label Aug 30, 2020
@pd93 pd93 removed the type: bug label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: watcher Changes related to the Taskfile watcher.
Projects
None yet
Development

No branches or pull requests

4 participants