-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
amphp/parallel + ssh2 #175
Comments
I've built a project you could deploy. You need PHP 8.0<= and ext-ssh2. |
You can't share objects over multiple parallel contexts. Objects are serialized and unserialized in the other context, so your connection will be lost during serialization. |
Thanks! I'm starting to understand... Could you please say why when a thread working my terminal sees nothing sent by echo/printf? I'm using logs to fix the issue, but it isn't very comfortable :( |
These parallel contexts are child processes with their own standard input and output streams. I think we do have some automatic forwarding to the parent streams, but I'm not too sure on that. |
I feel myself a stupid puppy :( Generally, I have two cute objects I'd like to send in the thread to use in. You know, it's about good practice. But I don't understand how it will be going in the context of parallel? What I can do with that? Do there any other parallel-like tools where I can do manage it better? |
No, you'll have this problem with any PHP library that does similar things. You can pass the connection details to the child context instead of the connection itself and establish a new connection in every child. |
Hello everyone! I like and very appreciate your work! Great library and docs!
I am trying to use ssh2 extension with parallel. Unfortunately, I am getting a mysterious issue. When I am calling a method in the object of my SSH class (for example, exec), the connection variable, initialized in the constructor, always resets to a "0" value instead of a resource. Full error looks like that:
What I am doing wrong? Thank you!
Main.php:
src/SSH.php:
src/SSHExecTask.php:
composer.json:
The text was updated successfully, but these errors were encountered: