teambition / gulp-ssh

SSH and SFTP tasks for gulp
184 stars 38 forks source link

Any way to log data during each command instead of the full data log at the end? #33

Closed icd2k3 closed 8 years ago

icd2k3 commented 8 years ago

I have a gulp-ssh task that is setup like this:

return gulpSSH
    .shell(['cd /mydir', 'git pull', 'npm install', 'gulp build'])
    .on('data', function(file) {
        console.log(file.contents.toString());
    });

The problem here is that ALL the data is logged AFTER all the tasks have run. Is there any way to display the data/logs as the tasks are being executed?

Thanks for the script and any suggestions!

grundera commented 8 years ago

Hi, try this:

return gulpSSH
    .shell(['cd /mydir', 'git pull', 'npm install', 'gulp build'])
    .on('ssh2Data', function (data) {
        process.stdout.write(data.toString());
    });
luchillo17 commented 8 years ago

@grundera That totally works, very very happy, though would like to be able to config the remote starting path in the configs instead of the '/' folder, should be able to close this issue.