jeking3/grunt-shell-spawn

Fatal error: No running process for target:...

Closed this issue · 4 comments

Hi, I got the following grunt configuration:

        watch: {
            proxy: {
                files: ['**/*.js'],
                tasks: ['proxy:restart']
            }
        },


        shell: {
            proxy: {
                command: 'node proxy.js',
                options: {
                    async: true,
                    canKill: true
                }
            }
        }

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-shell-spawn');

    grunt.registerTask('proxy:start', "starts the proxy", ['shell:proxy', 'watch:proxy'])
    grunt.registerTask('proxy:stop', "starts the proxy", ['shell:proxy:kill'])
    grunt.registerTask('proxy:restart', "starts the proxy", ['proxy:stop', 'proxy:start'])

Now the proxy starts just fine. However, when changing a file shell:proxy:kill does not find the proc. I did a little debugging: where here the procs hash is filled correctly, when trying to kill it later the procs hash is empty.

Any help is greatly appreciated :)

I just did a bunch of work with fixing :kill over on my fork: sergkr/grunt-shell-spawn. If you're still using grunt-shell-spawn and are able to give it a try, temporarily point your package.json to my fork:

"devDependencies": {
    "grunt-shell-spawn": "sergkr/grunt-shell-spawn#master"
}

And let me know if you're still running into these issues.

@SergKr Tried your solution. It didn't work for me. :(

try to add spawn: false to your watch and shell:proxy options. That helped my to maintain the state of grunt-shell-spawn.

But I personally ran into yet another issue when restarting the task a second time. Here the running process got lost again and couldn't be killed. I fixed it in #24.

Closing due to lack of activity. If you have a full reproducible test case we can have a look.