Skip to content
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

allow for only starting if needed #27

Open
mwhipple opened this issue Dec 20, 2016 · 2 comments
Open

allow for only starting if needed #27

mwhipple opened this issue Dec 20, 2016 · 2 comments

Comments

@mwhipple
Copy link

I'm presently using this plugin to manage an external process that isn't strictly tied to the build lifecycle, so it would be nice if the plugin had some additional logic to handle cases where it may already be running or may not be expected to be immediately cleaned up.

Presently I've started with using onlyIf{!pidFile} but it would be nice to have that be more expressive and set up to evolve.

I can see about putting a PR together at some point in the not too distant future or if I have something more substantial.

jhoch added a commit to jhoch/gradle-spawn-plugin that referenced this issue Feb 11, 2017
    - Fixes marc0der#27
    - If the process was killed but the pidFile was not deleted, this
      will proceed without executing command (silent failure).
    - Defaults to previous behavior (fail if pidFile exists)
    - Also changes "Server" to "$command" in exception message.
@abigpotostew
Copy link

upvote. I would like to be able to add a dependency that the process is alive, and start it if needed.

@gorky
Copy link

gorky commented Oct 19, 2017

Workaround:
task stopTask(type: KillProcessTask,...){
onlyIf ({return new File(directory, pidLockFileName).exists()})
...
}
task startTask(type: SpawnProcessTask,....){
onlyIf ({return !new File(directory, pidLockFileName).exists()})
...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants