@@ -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 | }); |
@@ -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 | }); |