grunt-nodemon icon indicating copy to clipboard operation
grunt-nodemon copied to clipboard

How to start another task after the nodemon server is listening?

Open codeofnode opened this issue 9 years ago • 2 comments

I am using grunt task-runner in nodejs application.

I want to run another grunt task only after the server started by nodemon is listening to a port. Please note that i can't run the tasks concurrently (because i don't know in how much time server will start listening), so grunt-concurrent didn't helped.

How could i do that.?

I have the following task config with grunt-nodemon:

nodemon: {
        dev: {
            script: 'server.js',
            options: {
                // options ..
                callback : function(nodemon){
                    nodemon.on('config:update',function(){
                        console.log('reached here .. '); // this get consoled on screen
                        grunt.task.run('mynewtask');
                    });
                },
                // options ...
            }
        },
        exec: {
            options: {
                exec: 'less'
            }
        }
    }
```javascript

But nothing happens after server start listening. mynewtask does not start at all. Not even any error is shown.

codeofnode avatar Jul 31 '15 06:07 codeofnode

+1

MarkusPint avatar Sep 16 '15 20:09 MarkusPint

Any updates on this? If I put a non-existing task, it fails, but when I put an existing one it doesn't seem to be doing anything.

stephanembl avatar Oct 15 '18 14:10 stephanembl