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

Calling devtools is blocking further tasks execution #27

Open
roman01la opened this issue Apr 15, 2014 · 3 comments
Open

Calling devtools is blocking further tasks execution #27

roman01la opened this issue Apr 15, 2014 · 3 comments

Comments

@roman01la
Copy link

Calling devtools task will block execution of any other tasks, if presented.

grunt.task.run([
      'clean:server',
      'bower-install',
      'concurrent:server',
      'autoprefixer',
      'express:dev',
      'devtools',
      'open',
      'watch'
]);

open and watch tasks will never run.

Running globally installed task in another tab in the console is kinda ok, but having the task automatically installed locally and being executed among others with grunt serve is a much more better approach.

@vladikoff
Copy link
Owner

Thanks for filing the issue. Let me experiment with this.

@roman01la
Copy link
Author

This caused by that line of code:

// run forever until the user kills the task
this.async();

What is need to be done is:

var done = grunt.task.current.async();

And call done when the task has finished running all the servers or got an error while running servers, this will notify Grunt to proceed executing further tasks.

Like this:

if (projectPort) {
    // start the server on that port
    server.listen(port, function () {
        grunt.log.ok("Grunt Devtools v" + version + " is ready! Proceed to the Chrome extension.");
        done();
    });
} else {
    grunt.fail.warn("You're running too many Grunt Devtools, please close one.");
    done();
}

This works great for me, no blocking anymore. But, the above code is running out of WebSocket server callback function, which is not really a problem, but still it would be better to call done when the task is really done setting up everything. According to websocket module reference, WebSocketServer constructor doesn't accept a callback function.

@tandrewnichols
Copy link

Is this still an active issue? I tried using grunt-bg-shell to wrap the devtools task, as an alternative approach, but the chrome extension never detects it . . . only when I run it directly. So having this work in conjunction with watch would be nice.

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