node-gradle / node-gradle/gradle-node-plugin
Gradle process stop doesn't lead to node process stop
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 677
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Description
Short: stopping gradle execution on Windows from command line by pressing Ctrl-C doesn't lead to stopping node.exe subprocess on Windows.
Steps to reproduce:
- Create project with webpack
- Configure
startatpackage.jsonscript via:
"scripts": {
"start": "webpack-dev-server --open --config webpack.dev.js"
}
- Create
npmStarttask via gradle kts script:
tasks {
val npmStart by registering(NpmTask::class) {
/*dependent tasks are skipped for simplification*/
setArgs(listOf("run", "start"))
}
}
- Start local node server via
.\gradlew.bat :npmStart - Wait for process start (web browser opens)
- Press
Ctrl-Cto stopnode.exeexecution
Expected result:
All child processes under gradle will be stopped.
Actual result:
Node.exe process remains. And this process starts to be zombie, e.g. process without parent.
Hint: probably (I'm not sure, this require testing), NpmTask should be inherited from Exec, not from DefaultTask. It means that args field will be inherited from Exec task, so it will be fully configurable via user. However next Gradle tool will be responsible to stop all child tasks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the NpmTask implementation and examining how it launches the npm run start command on Windows; compare it with the issue's suggested Exec inheritance. Reproduce with .\gradlew.bat :npmStart and Ctrl-C. Done means the node.exe process and its child processes stop without becoming orphaned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, nodejs
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100