ConsoleReaderThread: trim the string before returning it

it will have a newline at the end that was added by the subprocess when posting it to the main process.
This commit is contained in:
Dylan K. Taylor 2021-10-26 01:07:14 +01:00
parent 1d99cd329a
commit b9d9b69bbe
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -39,6 +39,7 @@ use function stream_socket_accept;
use function stream_socket_get_name;
use function stream_socket_server;
use function stream_socket_shutdown;
use function trim;
use const PHP_BINARY;
use const STREAM_SHUT_RDWR;
@ -113,7 +114,7 @@ final class ConsoleReaderThread extends Thread{
break;
}
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", $command);
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($command));
if($notifier !== null){
$notifier->wakeupSleeper();
}