zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 48 forks source link

afterFileGen Hooks in separate thread #108

Closed vexorian closed 10 years ago

vexorian commented 10 years ago

It seems to me that one of the most popular uses for AfterFileGen hook is to automatically open editor after the files are created. There is a slight practical issue with this and it is that if the editor / IDE doesn't automatically create a new thread when called, the editor will be closed automatically by greed.

The workaround is easy - create a script file to call the program in another thread and make greed call the script. But it is a bit too complicated and I am not sure if windows-friendly.

So we could have an option to make greed run the hook in a separate thread and not care about the exit code. Like:

                afterFileGen {
                    execute = /home/vx/dev/topcoder/threadcodeblocks.sh
                    arguments = ["${GeneratedFilePath}"]
                            separateThread = true
                }
vexorian commented 10 years ago

Actually, it makes me wonder if we need a separate afterProblemOpen hook. When you revisit a problem in practice room without overriding it is still nice to have it open automatically in editor.

zen0wu commented 10 years ago

If I'm understanding this right, you mean that if the user set the action to the browser or the editor, then it'll be killed by greed due to the timeout? We just need to disable the kill for these applications?

vexorian commented 10 years ago

Oh, so it is because of the timeout. A configurable timeout (Allowing infinite) seems to be the best choice here.