Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45: Add ssh2_send_eof function
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--TEST-- | ||
ssh2_send_eof() - Tests closing standard input | ||
--SKIPIF-- | ||
<?php require('ssh2_skip.inc'); ssh2t_needs_auth(); ?> | ||
--FILE-- | ||
<?php require('ssh2_test.inc'); | ||
|
||
$ssh = ssh2_connect(TEST_SSH2_HOSTNAME, TEST_SSH2_PORT); | ||
var_dump(ssh2t_auth($ssh)); | ||
|
||
$cmd=ssh2_exec($ssh, 'cat' . PHP_EOL); | ||
|
||
var_dump($cmd); | ||
|
||
stream_set_blocking($cmd, true); | ||
|
||
$content = "foo"; | ||
|
||
fwrite($cmd, $content); | ||
fflush($cmd); | ||
ssh2_send_eof($cmd); | ||
|
||
$response = stream_get_contents($cmd); | ||
var_dump($response === $content); | ||
echo $response . PHP_EOL; | ||
|
||
--EXPECTF-- | ||
bool(true) | ||
resource(%d) of type (stream) | ||
bool(true) | ||
foo | ||
|