Skip to content

Commit 416f823

Browse files
committed
fix: change Process::run to Process::start in ListenCommand for better output handling
1 parent 252e4c5 commit 416f823

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Console/ListenCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ public function handle(): void
1818
$this->warn('This running mode is very inefficient and only suitable for development purposes. DO NOT USE IN PRODUCTION!');
1919
$this->info('Listening...');
2020
while (true) {
21-
$result = Process::run([
21+
$result = Process::start([
2222
php_binary(), artisan_binary(), 'nutgram:run', '--once',
2323
'--pollingTimeout='.$this->option('pollingTimeout'),
24-
]);
24+
], function (string $type, string $output) {
25+
$this->output->write($output);
26+
})->wait();
2527
if ($result->exitCode() !== 0) {
26-
$this->line($result->output());
27-
$this->error($result->errorOutput());
28+
$this->error('An error occurred while running the bot. Exiting...');
2829
break;
2930
}
3031
}

0 commit comments

Comments
 (0)