teambition / gulp-ssh

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

Callback function #1

Closed ervasive closed 10 years ago

ervasive commented 10 years ago

Hi, thanks for the plugin.

Is it possible to add a callback function after the SSH connection is closed?

willemvb commented 10 years ago

My quick fix on line 77 of exec.js:

ssh.on('end', function () {
  gutil.log('SSH :: end');
  if(options.end){options.end()} ;
});

and in my gulpfile.js:

gulp.task('clean-remote', function (cb) {
    ssh.exec({
        command: ['...'],
        sshConfig: {
            ...
        },
        end: function() {
            cb();
        }
    });
});