Skip to content

Commit 224ef64

Browse files
committed
Added isInteractive method
1 parent 1494c6b commit 224ef64

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/CLI/Console.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ static public function confirm(string $question)
108108
* Log warning messages to console
109109
*
110110
* @param string $message
111-
* @return bool|int
111+
* @return void
112112
*/
113-
static public function exit(int $status = 0)
113+
static public function exit(int $status = 0): void
114114
{
115115
exit($status);
116116
}
@@ -120,7 +120,7 @@ static public function exit(int $status = 0)
120120
*
121121
* This function was inspired by: https://stackoverflow.com/a/13287902/2299554
122122
*/
123-
static public function execute(string $cmd, string $stdin = null, string &$stdout, string &$stderr, int $timeout = -1):int
123+
static public function execute(string $cmd, string $stdin = null, string &$stdout, string &$stderr, int $timeout = -1): int
124124
{
125125
$pipes = [];
126126
$process = \proc_open(
@@ -167,4 +167,9 @@ static public function execute(string $cmd, string $stdin = null, string &$stdou
167167

168168
return 1;
169169
}
170+
171+
public function isInteractive(): bool
172+
{
173+
return ('cli' === PHP_SAPI && ! defined('STDOUT'));
174+
}
170175
}

0 commit comments

Comments
 (0)