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

Node process not stopped #143

Open
jameskleeh opened this issue Sep 16, 2016 · 13 comments
Open

Node process not stopped #143

jameskleeh opened this issue Sep 16, 2016 · 13 comments

Comments

@jameskleeh
Copy link

jameskleeh commented Sep 16, 2016

I've configured a task to start a server to serve static assets:

task serve(type: NpmTask) {
    group = 'application'
    description = 'Serve the client side application'
    args = ['run', 'start']
}

When I stop the gradle task, the node executable keeps running. What are my options to ensure the process gets shut down?

@jameskleeh
Copy link
Author

@srs Are you still interested in maintaining this plugin?

@jameskleeh
Copy link
Author

I noticed someone had a similar problem and fixed it on a fork: laurimak@2505514

srs/gradle-gulp-plugin#1

@srs
Copy link
Owner

srs commented Sep 27, 2016

Hi.

Yes, still maintaining it since I use it in a lot of projects. It would be great to have a pull-request of this fix ;-)

@jameskleeh
Copy link
Author

@srs The code seems to have changed significantly since that fork was made. Could you take a look and attempt to apply it?

@srs
Copy link
Owner

srs commented Sep 28, 2016

Yes, will do.

@srs srs added node and removed node labels Dec 4, 2016
@kucharzyk
Copy link

I have the same issues while running angular-cli via YarnTask from gradle

After killing gradle with CTRL+C angular-cli is still running

@kucharzyk
Copy link

I've found temporary solution.

Disabling gradle deamon fix this issue.

Just create following gradle.properties file in project directory

org.gradle.daemon=false

With deamon disabled everything works allright.
With deamon enabled some node tasks are still alive after terminating gradle task

@jinwangchina
Copy link

hi @kucharzyk, seems your solution doesn't work to me, I use gradle to start webpack-dev-server, after stop the gradle task in Intellij, the webpack-dev-server is still working.

@drakenfly
Copy link

I have the same problem... A solution would be very great @srs :/

@slively
Copy link

slively commented May 31, 2017

I was having the same issue from a create-react-app project when trying to run the webpack dev server through yarn.

task start(type: YarnTask) {
  args = ['start']
}

What I saw was gradle would start a yarn process using project.exec and yarn would then start a node process (node script/start.js). When Gradle exited, the yarn process would exit, but the subsequent node process would stay around. I worked around this by just calling node directly using NodeTask.

task start(type: NodeTask) {
  script = file('scripts/start.js')
}

Now gradle only spawns a single node process and when gradle exits the node process exits (after a handful of seconds). This is certainly still an issue, but I've found this to be a very acceptable work around.

@yohanesgultom
Copy link

Adding org.gradle.daemon=false in gradle.properties does not work for me. I use --no-daemon option instead:

gradle --no-daemon

@KIC
Copy link

KIC commented Dec 29, 2017

alternatively you can still use the the deamon but use ./grawdlew --stop to kill all gradle processes (note that this is a flag and not a task, so it is in fact --stop. But it still takes a while until the node server is gone. You can check the status of the deamon by using ./gradlew --status.

@rlovtangen
Copy link

Tried different Gradle version. I'm having this issue with Gradle 3.2 and later (including 4.7, which is latest). Probably related to Ctrl-C changes described here: https://docs.gradle.org/3.2/release-notes.html#ctrl-c-no-longer-stops-the-daemon-on-first-run

Using --no-daemon seems to work.

My build.gradle:

plugins {
    id "com.moowork.node" version "1.2.0"
}

node {
    version = '10.0.0'
    yarnVersion = '1.6.0'
    download = true
}

task start(type: YarnTask, dependsOn: 'yarn') {
    group = 'application'
    description = 'Run the client app'
    args = ['run', 'start']
}

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

9 participants