1const exec = require('child_process').exec;
2
3function os_func() {
4 this.execCommand = function(cmd, callback) {
5 exec(cmd, (error, stdout, stderr) => {
6 if (error) {
7 console.error(`exec error: ${error}`);
8 return;
9 }
10
11 callback(stdout);
12 });
13 }
14}
15var os = new os_func();
16
17os.execCommand('SomeCommand', function (returnvalue) {
18 // Here you can get the return value
19});