summaryrefslogtreecommitdiffstats
path: root/environment-upstream.patch
blob: c52005f32b8131bc251b3b276e0f52843d9012b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From 52c68979fc4b369a0a0023808946795966773f8a Mon Sep 17 00:00:00 2001
From: Sebastian Bergmann <sb@sebastian-bergmann.de>
Date: Wed, 22 Oct 2014 17:14:56 +0200
Subject: [PATCH] Refactor

---
 src/Console.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Console.php b/src/Console.php
index 3c7b7f9..84fc94a 100644
--- a/src/Console.php
+++ b/src/Console.php
@@ -66,7 +66,7 @@ public function hasColorSupport()
             return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
         }
 
-        return function_exists('posix_isatty') && @posix_isatty(STDOUT);
+        return $this->isTty();
     }
 
     /**
@@ -92,4 +92,12 @@ public function getNumberOfColumns()
 
         return 80;
     }
+
+    /**
+     * @return boolean
+     */
+    private function isTty()
+    {
+        return function_exists('posix_isatty') && @posix_isatty(STDOUT);
+    }
 }
From 07a5d03892f4e31bc16f97c58de100c04f95b731 Mon Sep 17 00:00:00 2001
From: Sebastian Bergmann <sb@sebastian-bergmann.de>
Date: Fri, 24 Oct 2014 10:51:36 +0200
Subject: [PATCH] Make sure we have a tty before using stty

---
 src/Console.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Console.php b/src/Console.php
index 84fc94a..ac1b1a3 100644
--- a/src/Console.php
+++ b/src/Console.php
@@ -66,7 +66,7 @@ public function hasColorSupport()
             return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
         }
 
-        return $this->isTty();
+        return $this->isTty(STDOUT);
     }
 
     /**
@@ -82,6 +82,10 @@ public function getNumberOfColumns()
             return 79;
         }
 
+        if (!$this->isTty(STDIN)) {
+            return 80;
+        }
+
         if (preg_match('#\d+ (\d+)#', shell_exec('stty size'), $match) === 1) {
             return (int) $match[1];
         }
@@ -94,10 +98,11 @@ public function getNumberOfColumns()
     }
 
     /**
+     * @param  resource $fd
      * @return boolean
      */
-    private function isTty()
+    private function isTty($fd)
     {
-        return function_exists('posix_isatty') && @posix_isatty(STDOUT);
+        return function_exists('posix_isatty') && @posix_isatty($fd);
     }
 }
From 6e6c71d918088c251b181ba8b3088af4ac336dd7 Mon Sep 17 00:00:00 2001
From: Sebastian Bergmann <sb@sebastian-bergmann.de>
Date: Sat, 25 Oct 2014 10:00:45 +0200
Subject: [PATCH] Make sure we have STDIN and STDOUT before using them

---
 src/Console.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Console.php b/src/Console.php
index ac1b1a3..13a9672 100644
--- a/src/Console.php
+++ b/src/Console.php
@@ -66,6 +66,10 @@ public function hasColorSupport()
             return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
         }
 
+        if (!defined('STDOUT')) {
+            return false;
+        }
+
         return $this->isTty(STDOUT);
     }
 
@@ -82,7 +86,7 @@ public function getNumberOfColumns()
             return 79;
         }
 
-        if (!$this->isTty(STDIN)) {
+        if (!defined('STDIN') || !$this->isTty(STDIN)) {
             return 80;
         }