File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,22 @@ function _create($loop) : Promise
5151
5252function 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 ();
You can’t perform that action at this time.
0 commit comments