Skip to content

Commit 0c943f4

Browse files
committed
Fixed bug
1 parent 876cf27 commit 0c943f4

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

fauxton-config

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,22 @@ function _create($loop) : Promise
5151

5252
function main($loop) : Promise
5353
{
54-
$action = compose(
55-
Http\_readConfig,
56-
partialRight(Http\_toPromise, function (string $result, callable $resolve) use ($loop) {
57-
_create($loop)->then(function (\React\Stream\WritableStreamInterface $stream) use ($resolve, $result) {
58-
$stream->write($result);
59-
$stream->end();
60-
$resolve(IO('Data written to file'));
61-
});
62-
})
54+
return Http\_readConfig($loop)->then(
55+
function (string $content) use ($loop) {
56+
return \React\Promise\resolve(
57+
_create($loop)->then(
58+
function ($stream) use ($content) {
59+
$stream->write($content);
60+
$stream->end();
61+
return IO('Data written to file');
62+
},
63+
function ($error) {
64+
return IO($error->getMessage());
65+
}
66+
)
67+
);
68+
}
6369
);
64-
return $action($loop);
6570
}
6671

6772
$loop = \React\EventLoop\Factory::create();

0 commit comments

Comments
 (0)