var assert = require('assert');
var exec = require('../').exec;
var spawn = require('../').spawn;

exec('echo hello')
    .then(function(result) {
        var stdout = result.stdout;
        var stderr = result.stderr;

        //console.log('stdout: ', stdout);
        //console.log('stderr: ', stderr);
        assert.equal(stdout.toString(), 'hello\n');
        assert.equal(stderr.toString(), '');
    })
    .fail(function(err) {
        console.error("ERROR: ", (err.stack || err));
    })
    .progress(function(childProcess) {
        console.log('[exec] childProcess.pid: ', childProcess.pid);
    });

var spawnOut = '';
var spawnErr = '';

spawn('echo', ['hello'])
    .progress(function(childProcess) {
        console.log('[spawn] childProcess.pid: ', childProcess.pid);
        childProcess.stdout.on('data', function(data) {
            spawnOut += data;
            
        });
        childProcess.stderr.on('data', function(data) {
            spawnErr += data;
            
        });
    })
    .then(function(result) {
        //console.log('stdout: ', stdout);
        //console.log('stderr: ', stderr);
        assert.equal(spawnOut.toString(), 'hello\n');
        assert.equal(spawnErr.toString(), '');
    })
    .fail(function(err) {
        console.error("ERROR: ", (err.stack || err));
    });
@@ -610,27 +610,8 @@
 );%0A%0A
-var spawnOut = '';%0A
 var 
@@ -625,16 +625,16 @@
 r = '';%0A
+
 %0Aspawn('
@@ -763,119 +763,8 @@
 d);%0A
-        childProcess.stdout.on('data', function(data) %7B%0A            spawnOut += data;%0A            %0A        %7D);%0A
     
@@ -849,21 +849,9 @@
 ta;%0A
-            
 %0A
+
     
@@ -1005,15 +1005,13 @@
 ual(
-spawnOu
+resul
 t.to
@@ -1166,15 +1166,16 @@
  err));%0A
-
     %7D);
+%0A

Update `spawn` test