Skip to content

Commit b6933c2

Browse files
committed
fix(MusicCommand): trim stdin input to remove trailing spaces
- Change `rtrim` to `trim` for stdin input to remove both leading and trailing spaces. - Close the stdin stream after reading to prevent resource leaks. - Ensure consistent handling of input regardless of whitespace.
1 parent 6dbe893 commit b6933c2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/Commands/MusicCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ public function handle(): void
6868
->when(windows_os(), static fn () => warning(__('windows_hint')))
6969
->tap(static function () use (&$stdinKeyword): void {
7070
if (($fstat = fstat(\STDIN)) && 0 < $fstat['size']) {
71-
$stdinKeyword = rtrim(stream_get_contents(\STDIN));
71+
$stdinKeyword = trim(stream_get_contents(\STDIN));
72+
fclose(\STDIN);
7273
}
73-
74-
// fclose(\STDIN);
7574
})
7675
->tap(function () use (&$keyword, $stdinKeyword): void {
7776
$keyword = str($stdinKeyword ?: $this->argument('keyword') ?? text(

0 commit comments

Comments
 (0)