ChrisWren / grunt-nodemon

Grunt task to run nodemon
MIT License
345 stars 37 forks source link

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

Open codeofnode opened 9 years ago

codeofnode commented 9 years ago

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.
MarkusPint commented 9 years ago

+1

stephanembl commented 6 years ago

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.