@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $ssh2->on('connect', function(SSH2Interface $ssh2) { |
| 60 | 60 | echo "# CONNECTED\n"; |
| 61 | 61 | $ssh2->createDriver(SSH2::DRIVER_SFTP) |
| 62 | - ->connect(); |
|
| 62 | + ->connect(); |
|
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | 65 | $ssh2->on('disconnect', function(SSH2Interface $ssh2) use($loop) { |
@@ -37,7 +37,8 @@ |
||
| 37 | 37 | $file->write(); |
| 38 | 38 | $file->on('drain', function(SSH2ResourceInterface $file) use(&$lines, &$linesPointer) { |
| 39 | 39 | echo "# PART OF THE DATA HAS BEEN WRITTEN\n"; |
| 40 | - if ($linesPointer < count($lines)) { |
|
| 40 | + if ($linesPointer < count($lines)) |
|
| 41 | + { |
|
| 41 | 42 | $file->write($lines[$linesPointer++]); |
| 42 | 43 | } |
| 43 | 44 | }); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $ssh2->on('connect', function(SSH2Interface $ssh2) { |
| 68 | 68 | echo "# CONNECTED\n"; |
| 69 | 69 | $ssh2->createDriver(SSH2::DRIVER_SHELL) |
| 70 | - ->connect(); |
|
| 70 | + ->connect(); |
|
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | 73 | $ssh2->on('disconnect', function(SSH2Interface $ssh2) use($loop) { |
@@ -19,7 +19,8 @@ discard block |
||
| 19 | 19 | use Dazzle\SSH\SSH2Interface; |
| 20 | 20 | use Dazzle\SSH\SSH2ResourceInterface; |
| 21 | 21 | |
| 22 | -function executeCommand(SSH2DriverInterface $shell, $shellCommand) { |
|
| 22 | +function executeCommand(SSH2DriverInterface $shell, $shellCommand) |
|
| 23 | +{ |
|
| 23 | 24 | |
| 24 | 25 | $buffer = ''; |
| 25 | 26 | $command = $shell->open(); |
@@ -49,12 +50,14 @@ discard block |
||
| 49 | 50 | $commandsRemain = count($commands); |
| 50 | 51 | |
| 51 | 52 | $shell->on('resource:close', function(SSH2DriverInterface $shell) use(&$commandsRemain) { |
| 52 | - if (--$commandsRemain === 0) { |
|
| 53 | + if (--$commandsRemain === 0) |
|
| 54 | + { |
|
| 53 | 55 | $shell->disconnect(); |
| 54 | 56 | } |
| 55 | 57 | }); |
| 56 | 58 | |
| 57 | - foreach ($commands as $command) { |
|
| 59 | + foreach ($commands as $command) |
|
| 60 | + { |
|
| 58 | 61 | executeCommand($shell, $command); |
| 59 | 62 | } |
| 60 | 63 | }); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $ssh2->on('connect', function(SSH2Interface $ssh2) { |
| 68 | 68 | echo "# CONNECTED\n"; |
| 69 | 69 | $ssh2->createDriver(SSH2::DRIVER_SHELL) |
| 70 | - ->connect(); |
|
| 70 | + ->connect(); |
|
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | 73 | $ssh2->on('disconnect', function(SSH2Interface $ssh2) use($loop) { |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $ssh2->on('connect', function(SSH2Interface $ssh2) { |
| 60 | 60 | echo "# CONNECTED\n"; |
| 61 | 61 | $ssh2->createDriver(SSH2::DRIVER_SFTP) |
| 62 | - ->connect(); |
|
| 62 | + ->connect(); |
|
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | 65 | $ssh2->on('disconnect', function(SSH2Interface $ssh2) use($loop) { |