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

Is the run method supposed to work with SFTP? #49

Open
ewstefan opened this issue Jul 13, 2017 · 3 comments
Open

Is the run method supposed to work with SFTP? #49

ewstefan opened this issue Jul 13, 2017 · 3 comments

Comments

@ewstefan
Copy link

I can retrieve files from my sftp via. This works:

$contents = SSH::into('my_sftp')->getString('filename.csv');

However, I can't get the run method to work:

$commands = ['ls'];

SSH::into('my_sftp')->run($commands, function($line)
{
// this callback is never called
 echo $line.PHP_EOL;
 });

Furthermore, status is always === false, in both cases above.

$status = SSH::into('banz_sftp')->status();

Thanks for any pointer or help!
Stefan

@ewstefan
Copy link
Author

I've found a workaround.

The underlying SFTP class can be accessed, which provides all sorts of filesystem functionality, such as nlist:

$remote = SSH::into('my_sftp');
$connection = $remote->getGateway()->getConnection();
$list = $connection->nlist('*.zip');

See also: https://www.webniraj.com/2017/05/05/laravel-5-2-more-ssh-sftp-commands/

@stidges
Copy link

stidges commented Aug 31, 2017

It should be supported. Have you tried assigning the output of the run command to a variable (e.g. $output = SSH::into('my_sftp')->run('ls');)? I see that the underlying library doesn't call the callback in some cases.

@ewstefan
Copy link
Author

@stidges : Thanks for getting back.

I have not tried your suggestion, as I decided to go with league/flysystem-sftp.

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

2 participants