I am using child-process-promise module. So I have something like this:
var promise = require('child-process-promise').spawn;
promise('some_command_producing_output')
    .then(function (result) {
        ...
    })
    .catch(function (err) {
        ...
    });
What I want is to add some processing after command produced output in stdout. So finally I want to create a function to use like this:
RunCommandAndProcess('some_command_producing_output')
    .then(function (result) {
        ...
    })
    .catch(function (err) {
        ...
    });
The function should use promise from child-process-promise, wait until successful result produced and return promise for processing data.
 
    