Skip to content

Commit 7f3b81f

Browse files
committed
Fix typo, missing hook-in
1 parent c1c1997 commit 7f3b81f

File tree

3 files changed

+25
-54
lines changed

3 files changed

+25
-54
lines changed

EProcess/Adapter/ChildProcess.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use EProcess\Behaviour\UniversalSerializer;
66
use EProcess\MessengerFactory;
7-
7+
use EProcess\Stream\FullDrainStream;
88
use React\ChildProcess\Process;
99
use Symfony\Component\Process\PhpExecutableFinder;
1010

@@ -69,8 +69,12 @@ public function create($class, array $data = [])
6969

7070
$this->process = new Process($php);
7171
$this->process->start($this->loop, 0.1);
72-
73-
$this->process->stdin->resume();
72+
73+
$this->process->stdin = new FullDrainStream(
74+
$this->process->stdin->stream,
75+
$this->loop
76+
);
77+
7478
$this->process->stdin->write($script);
7579

7680
$this->process->stdin->on('full-drain', function() {

EProcess/Stream/FullDrainSteam.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

EProcess/Stream/FullDrainStream.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace EProcess\Stream;
4+
5+
use React\Stream\Stream;
6+
use React\EventLoop\LoopInterface;
7+
8+
class FullDrainStream extends Stream
9+
{
10+
public function __construct($stream, LoopInterface $loop)
11+
{
12+
parent::__construct($stream, $loop);
13+
14+
$this->buffer->on('full-drain', function () {
15+
$this->emit('full-drain', array($this));
16+
});
17+
}
18+
}

0 commit comments

Comments
 (0)