Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,22 @@ class GulpSSH extends EventEmitter {
const write = sftp.createWriteStream(filePath, options)

write
.on('open', function() {
if (file.isStream()) file.contents.pipe(write)
else if (file.isBuffer()) write.end(file.contents)
else {
err = new PluginError(packageName, 'file error!')
write.end()
}
})
.on('error', function (error) {
err = error
})
.on('finish', function () {
.on('close', function () {
sftp.end()
if (err) callback(err)
else callback(null, file)
})

if (file.isStream()) file.contents.pipe(write)
else if (file.isBuffer()) write.end(file.contents)
else {
err = new PluginError(packageName, 'file error!')
write.end()
}
})
})
}, function (callback) {
Expand Down Expand Up @@ -346,8 +347,8 @@ class GulpSSH extends EventEmitter {

let lastCommand
commands.forEach(function (command) {
if (command[command.length - 1] !== '\n') command += '\n'
log(packageName + ' :: shell :: ' + command)
if (command[command.length - 1] !== '\n') command += '\n'
stream.write(command)
lastCommand = command
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gulp-ssh",
"version": "0.7.1",
"version": "0.7.2",
"description": "SSH and SFTP tasks for gulp",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -32,7 +32,7 @@
"ansicolors": "^0.3.2",
"fancy-log": "^1.3.2",
"plugin-error": "^1.0.1",
"ssh2": "~0.5.5",
"ssh2": "^1.14.0",
"through2": "^2.0.3",
"vinyl": "^2.1.0"
},
Expand Down