You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a "General Error" when using Windows and executing a command. After investigating, I came across PR #64 and experimented with a few tweaks to resolve the issue. Here's what worked for me:
The Issue
The << syntax doesn't work in the Windows Command Shell. However, you can use double quotes (") instead.
The Solution
I extended the SSH class in my project and made the following changes:
To ensure compatibility, I added a flag in my project that uses this custom SSH class if the application is running on a Windows machine.
You might wonder: "Why not open a PR to fix this issue?" Unfortunately, I don’t currently have the time to contribute a proper fix with tests. Since this solution was developed for my hobby project, I didn’t prioritize making it a formal PR. Besides, I suspect there aren't many Windows users in the PHP community who would encounter this issue.
I hope this helps someone facing a similar problem. If you have suggestions or improvements, feel free to share. Thanks!
This discussion was converted from issue #112 on December 30, 2024 09:37.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I encountered a "General Error" when using Windows and executing a command. After investigating, I came across PR #64 and experimented with a few tweaks to resolve the issue. Here's what worked for me:
The Issue
The
<<
syntax doesn't work in the Windows Command Shell. However, you can use double quotes ("
) instead.The Solution
I extended the
SSH
class in my project and made the following changes:Key Changes
EOF
part and replaced it with double quotes around the commands.&&
between commands to ensure they run sequentially on the server.Example Usage
Here’s how I use the modified class:
Example Output
Additional Notes
To ensure compatibility, I added a flag in my project that uses this custom SSH class if the application is running on a Windows machine.
You might wonder: "Why not open a PR to fix this issue?" Unfortunately, I don’t currently have the time to contribute a proper fix with tests. Since this solution was developed for my hobby project, I didn’t prioritize making it a formal PR. Besides, I suspect there aren't many Windows users in the PHP community who would encounter this issue.
I hope this helps someone facing a similar problem. If you have suggestions or improvements, feel free to share. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions