Skip to content

Commit 6149416

Browse files
committed
rm bit about sleep and add comment in about reset()
phpseclib/phpseclib#1999 (3.0.38; June 17, 2024) made it so sleep commands can timeout but also made it so that $ssh->reset() is now needed after a timed out $ssh->exec() call
1 parent 93391fd commit 6149416

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/commands.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ After each `$ssh->read()` the timeout resets to what you set it to last. By defa
137137

138138
`$ssh->isTimeout()` will return true if the result of the last `$ssh->read()` or `$ssh->exec()` was due to a timeout. Otherwise it will return false.
139139

140-
`$ssh->setTimeout()` works with `$ssh->read()` and `$ssh->exec()`.
141-
142-
Unfortunately, commands like `$ssh->exec('sleep 10')` don't work well with `$ssh->setTimeout()` as discussed in [issue # 1440](https://github.com/phpseclib/phpseclib/issues/1440). eg. if you have a timeout of 5s and are doing `$ssh->exec('sleep 10')` it may not, in fact, return after 5s, but rather, after 10s. This can somewhat be worked around by doing `$ssh->exec('nohup sleep 10 > /dev/null 2>&1 &')` or `$ssh->exec('timeout 5 sleep 10')`, depending on what you're trying to do.
140+
`$ssh->setTimeout()` works with `$ssh->read()` and `$ssh->exec()`. If an `$ssh->exec()` call times out and you want to run another `$ssh->exec()` call after the timed out one, do `$ssh->reset()`.
143141

144142
## setKeepAlive()
145143

0 commit comments

Comments
 (0)