Skip to content

Commit

Permalink
Merge pull request #303 from hungtrinh/zend-progresbar-fix-tty
Browse files Browse the repository at this point in the history
[zend-progressbar] fix "stty: 'standard input': Inappropriate ioctl for device" spam
  • Loading branch information
glensc authored Jan 11, 2023
2 parents d147f02 + 943e71d commit 504e75d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Zend/ProgressBar/Adapter/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public function setWidth($width = null)
$this->_width = 80;

// Try to determine the width through stty
if (preg_match('#\d+ (\d+)#', (string) @shell_exec('stty size'), $match) === 1) {
if (preg_match('#\d+ (\d+)#', (string) @shell_exec('stty size 2>/dev/null'), $match) === 1) {
$this->_width = (int) $match[1];
} else if (preg_match('#columns = (\d+);#', (string) @shell_exec('stty'), $match) === 1) {
} else if (preg_match('#columns = (\d+);#', (string) @shell_exec('stty 2>/dev/null'), $match) === 1) {
$this->_width = (int) $match[1];
}
}
Expand Down

0 comments on commit 504e75d

Please sign in to comment.