Answers for "how to wait for an exec command to fininsh in nodejs"

0

how to wait for an exec command to fininsh in nodejs

const exec = require('child_process').exec;

function os_func() {
    this.execCommand = function(cmd, callback) {
        exec(cmd, (error, stdout, stderr) => {
            if (error) {
                console.error(`exec error: ${error}`);
                return;
            }

            callback(stdout);
        });
    }
}
var os = new os_func();

os.execCommand('SomeCommand', function (returnvalue) {
    // Here you can get the return value
});
Posted by: Guest on June-29-2020

Code answers related to "how to wait for an exec command to fininsh in nodejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language