Gradle task for Foreground Process (plus Ctrl-C stuff)

Hi everyone, I’m a student messing around for the summer and am experimenting with Gradle. I’m having fun learning it, but unfortunately am running into a roadblock. I don’t know enough to formulate a question, so I’m here to describe my situation and hope that anyone could guide me towards the right direction.

Links I’ve been looking at: Run finalizedBy when task is interrupted (ctrl-c), Ctrl-c during running build also kills daemon. (My apologies if my issue is addressed somewhere in there)

I’m currently running Gradle v3.5 and my goal is to create a task to run a server in the foreground. Ordinarily, if I execute the run command in the CLI, it becomes a running foreground process that would log server activity. When terminated with Ctrl-C, it gives a shut down message. This conflicts with Gradle because: 1) An intentionally hanging process will not complete, leaving an irrelevant build progress bar; 2) Hitting Ctrl-C would kill the Gradle daemon and end the process without the desired shut down message. In fact, running the task with --no-daemon and hitting Ctrl-C still seems to bypass printing a shut down message. How? I’ve looked into writing an Exec task in the build.gradle file and I’ve looked into writing a shutDownHook and ProcessBuilder in my Groovy file. There’s more mess with redirecting log output, but maybe we can overlook that for now.

Is my goal even achievable? It seems to conflict directly with Gradle design with how the build daemon runs. I’ve been looking at the Internet for a couple of days now and felt it best now to just reach out to the Gradle group themselves. Do you guys know of a solution, or have an idea as to what I should do? I’ll try my best to provide any additional information upon request and look forward to a reply.

Edit:
addShutDownHook {} in task to catch a Ctrl-C, but still getting that 0% execution line