-
Notifications
You must be signed in to change notification settings - Fork 32
feature to kill the previously started process #24
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
Comments
Definitely a problem. I'm surprised I haven't run into that. I'll think of something and should have a fix in the soon. |
One other issue I noticed for my team mate is that windows doesn't allow you to overwrite an exe file that is already running. So I'll have to first kill the running process and only then do a build. So yeah, this feature looks to be a necessity. Let me see if I can make the killSpawned function public and see if it works. Will send a pull request if. |
This might take a couple of days. The solution is to add Start method to the context so the task can track the process and then add a Task.Kill method. Unfortunately, there's a little more to it. There are goroutines involved when watching so I have to do some refactoring to add quit channels. I'll work on it tonight and should have something by tomorrow. |
I need to understand your process a bit more. In most cases, if a dependency fails the parent shouldn't be restarted. For example
If "assets" fails then there should be an error logged in red if the task returned an error. eg
We found it annoying that we had to restart godo often when all we had to do was fix syntax in Javascript file. Once we fixed the error in our editor, it triggers a restart of the server. I admit though every now and then someone forgets to check their terminal for errors. Also, you don't normally need to build any Go files before I can add a flag to always exit on errors if that would help. I'm not sure if it should be the default behavior. |
I'm checking some of these things you asked and I'm seeing weird results. One, I actually am not able to run it via go run. I see this other stackoverflow qn about it too: http://stackoverflow.com/questions/26920969/why-does-the-go-run-command-fail-to-find-a-second-file-in-the-main-package I also am not able to do a go run *.go because then it complains that it cannot run _test.go files. So I guess only the build and run executable option is currently available for me. |
To your other question, here is what happens/happened to me ...
Here is what would be preferable in my opinion ...
|
Interesting, I created an example in godo. If I run
Then CD into the godo.v1 directory and run When you say change code, are you doing a git checkout to another branch whlie godo is watching? I will add a flag that will stop on any error. |
Changing code as in fixing bugs and adding features locally. I miss a parentheses here or there, build breaks, but older executable is still running. I was thinking that if you made your killSpawned -> KillSpawned, then we'd have a way to control it ourselves. Also, as I mentioned, on my team mate's Windows ... assume the process is running from a previous build. So I've previously started executable.exe. When I do a go build again, windows gives me an error because it cannot overwrite the exe file of a running process. So godo always fails. |
Please post a gitst of your Godofile, the relevant parts that are causing this. I made a fix on Windows. Not sure if it helps your teammate. I hardly use Windows but I did try the example and there was an issue with it. The example works while watching now. Please update godo and let me know. |
I'm a little embarrassed to show you my current Godofile as it is not really following the dependencies mechanism. Instead I'm controlling each line of execution at the moment. I liked Godo and I wanted to tell others in my team and also keep a note of it for later, so I immediately (maybe a little too early) wrote this medium post: https://medium.com/@sathishvj/watch-generate-build-execute-golang-projects-on-file-changes-50255a98ab7c |
The golang tools are finicky, to say the least. Using |
Hmm, and there isn't a way to kill the process tree with go? Anyways, I'm not running it with go run. I'm doing a ./executable. So that issue doesn't apply in this case. I think, at the least, you could make the killSpawned function public, so that if somebody wants to call that specifically, we could. If not, no loss anyways. |
I can do that. I'll do it first thing in the morning. It's getting late. BTW, you can see which files are changing with the verbose flag |
Oh ok. Thanks. I tried -v which is the idiomatic way I think of getting verbose output. But it gave me version. |
In the process of refactoring for godo version 2 (v2) and writing tests, I ran into the Debounce/Watch issues you were having. Watch file events were being swallowed in between Debounce intervals. For example, say The watch algorithm in v1 is crude and worked for my uses cases. The v2 is more intelligent and efficient. I hope to do a v2 pre-release in about a week. |
awesome man! thank you for your work. |
I'd like to suggest/request a feature/function to kill the previously 'Start'ed process. I know 'Start' will do that, but what if a build we did in a previous process failed and we don't do a Start?
My scenario:
Oops! Build failed Skip all remaining steps, including 'Start'
Now, the process 'Start'ed on the earlier set is still running and my app is still accessible which is not the expected result.
The text was updated successfully, but these errors were encountered: