import Spawner from 'promise-spawner';
import logger from './logger';
import { isDebug } from './utils';

export default class Command {
  constructor(command, inheritIo = isDebug()) {
    this.command = command;
    const modifiers = {
      out(d) { return d; },
      err: 'this is an error: ',
    };

    this.spawner = new Spawner(modifiers, {
      stdio: inheritIo ? 'inherit' : 'ignore',
    });

    if (inheritIo) {
      this.spawner.out.pipe(process.stdout);
      this.spawner.err.pipe(process.stdout);
    }
  }
  run = () => {
    logger(`running command: ${this.command}`);
    return this.spawner.spawn(this.command);
  }
}

@@ -233,74 +233,8 @@
  = %7B
-%0A      out(d) %7B return d; %7D,%0A      err: 'this is an error: ',%0A    
 %7D;%0A%0A
@@ -319,13 +319,11 @@
  : '
-ignor
+pip
 e',%0A
@@ -340,24 +340,24 @@
    if (i
-nheritIo
+sDebug()
 ) %7B%0A    
@@ -432,27 +432,27 @@
 (process.std
-out
+err
 );%0A    %7D%0A  %7D
@@ -516,16 +516,168 @@
 and%7D%60);%0A
+    return new Promise((resolve, reject) =%3E %7B%0A      this.spawner.spawn(this.command).then(function(code) %7B%0A        resolve(this.data);%0A      %7D)%0A    %7D);%0A
     retu

update command.js to return output with run()