Skip to content

Commit 15412eb

Browse files
committed
fix: co run error
1 parent c1babcf commit 15412eb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/AbstractCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Inhere\Console\Util\FormatUtil;
1919
use Inhere\Console\Util\Helper;
2020
use Swoole\Coroutine;
21+
use Swoole\Event;
2122
use Toolkit\PhpUtil\PhpDoc;
2223

2324
/**
@@ -233,11 +234,10 @@ public function run(string $command = '')
233234
*/
234235
public function coroutineRun()
235236
{
236-
$ch = new Coroutine\Channel(1);
237-
$ok = Coroutine::create(function () use ($ch) {
237+
// $ch = new Coroutine\Channel(1);
238+
$ok = Coroutine::create(function (){
238239
$result = $this->execute($this->input, $this->output);
239-
$ch->push($result);
240-
// $this->getApp()->stop($status);
240+
// $ch->push($result);
241241
});
242242

243243
// create co fail:
@@ -250,8 +250,9 @@ public function coroutineRun()
250250
// exec by normal flow
251251
$result = $this->execute($this->input, $this->output);
252252
} else { // success: wait coroutine exec.
253-
// Event::wait();
254-
$result = $ch->pop(10);
253+
Event::wait();
254+
$result = 0;
255+
// $result = $ch->pop(10);
255256
}
256257

257258
return $result;

0 commit comments

Comments
 (0)