Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Call Fail #4

Closed
daKuleMune opened this issue Sep 9, 2011 · 3 comments
Closed

Multiple Call Fail #4

daKuleMune opened this issue Sep 9, 2011 · 3 comments

Comments

@daKuleMune
Copy link

Not sure it is just not supported, but when attempting to send multiple commands it crashes, or stops working. Please note I understand how to work with asynchronous code, so while my examples look synchronous they are not.

I issued the following when stopped working with no reporting, I think it connected to the anonymous server but the change directory should still error out:

conn = new ftp( { host:"localhost" } );
conn.on( 'connect', function(){
  conn.auth( username, password );
  conn.cwd( folder );
  conn.mkdir( "data" );
});

The following crashes ftp.js:160 if( code == 250 && self._queue[0][0] === 'MLST' ) TypeError: Cannot read property '0' of undefined:

conn = new ftp( { host:"localhost" } );
conn.on( 'connect', function(){
  conn.auth( username, password, function( e ){ );
    conn.cwd( folder );
    conn.mkdir( "data" );
    conn.rmdir( "data" );
  });
});

My work around was to make my own queue in my main function, but having the system work with queues would help make it easy to use and avoid over anonymoizing.

@mscdex
Copy link
Owner

mscdex commented Jul 16, 2012

Do you still notice this with 0.1.3?

@AndrewGoal
Copy link

0.1.3 has same issue:

                ftp.con.pwd(function(err,pwd){console.log("first",pwd)});

                console.log(ftp.con.cwd(remotebase,function(err){
                        ftp.con.pwd(function(err,pwd){console.log("second",pwd)});
                }));

                ftp.con.pwd(function(err,pwd){console.log("third",pwd)});

my console show:

true
first /home/empapp
third /home/empapp
second undefined

Why is second undefined?

When I comment a line:

                ftp.con.pwd(function(err,pwd){console.log("first",pwd)});

                console.log(ftp.con.cwd(remotebase,function(err){
//                      ftp.con.pwd(function(err,pwd){console.log("second",pwd)});
                }));

                ftp.con.pwd(function(err,pwd){console.log("third",pwd)});

The console show :

true
first /home/empapp
third /home/empapp

/root/node_modules/ftp/ftp.js:160
          if (code === 250 && self._queue[0][0] === 'MLST')
                                            ^
TypeError: Cannot read property '0' of undefined
    at Socket.<anonymous> (/root/node_modules/ftp/ftp.js:160:45)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:362:31)


@mscdex
Copy link
Owner

mscdex commented Dec 16, 2012

This should be fixed now in the master branch, let me know either way if it's still causing this issue for you or not.

@mscdex mscdex closed this as completed Dec 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants