spmjs / node-scp2

[MAINTAINER WANTED] A pure javascript scp program based on ssh2.
384 stars 96 forks source link

Process hangs on overwriting file #58

Open stefannew opened 8 years ago

stefannew commented 8 years ago

I am uploading a pdf file to an sftp server using your module, but the process is hanging if the file already exists.

Local file is chmod to 777.

var Service,
    client = require('scp2'),
    Q = require('q'),
    fs = require('fs');

Service = function () {};

Service.prototype.uploadFile = function (conn, settings, path) {
    var deferred,
        filename = path.substring(path.lastIndexOf('/') + 1);

    deferred = Q.defer();

    client.scp(path, {
        host: settings.host,
        username: settings.user,
        password: settings.password,
        path: settings.path
    }, function (error) {
        if (error) {
            console.log('Error');

            deferred.reject(error);
        }

        client.close();
        console.log('Callback called.');
        deferred.resolve(path);
    });

    return deferred.promise;
};

module.exports = Service;

Is this a known issue? I'm fairly certain i'm using the module as intended.

kosz commented 8 years ago

process seems to hang on a lot more situations than this :(