@@ -16,7 +16,7 @@ class Local {
16
16
public $ pid = NULL ;
17
17
18
18
public function __construct () {
19
- $ this ->key = getenv ("BROWSERSTACK_ACCESS_KEY " );
19
+ $ this ->key = getenv ("BROWSERSTACK_KEY " );
20
20
$ this ->logfile = getcwd () . "/local.log " ;
21
21
$ this ->user_args = array ();
22
22
}
@@ -94,31 +94,15 @@ public function start($arguments) {
94
94
$ this ->binary = new LocalBinary ();
95
95
$ this ->binary_path = $ this ->binary ->binary_path ();
96
96
97
- $ descriptorspec = array (
98
- 0 => array ("pipe " , "r " ),
99
- 1 => array ("pipe " , "w " ),
100
- 2 => array ("pipe " , "w " )
101
- );
102
-
103
97
$ call = $ this ->start_command ();
104
98
if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' )
105
99
system ('echo "" > ' . '$this->logfile ' );
106
100
else
107
101
system ("echo \"\" > ' $ this ->logfile ' " );
108
-
109
- $ this ->handle = proc_open ($ call , $ descriptorspec , $ this ->pipes );
110
- $ return_message = "" ;
111
- while (!feof ($ this ->pipes [1 ]))
112
- {
113
- $ return_message = $ return_message + fgets ($ pipes [1 ], 1024 );
114
- if (strlen ($ return_message ) == 0 ) break ;
115
- ob_flush ();
116
- flush ();
117
- }
118
-
119
- fclose ($ this ->pipes [1 ]);
120
- $ data = json_encode ($ return_message );
121
- if ($ data ['state ' ] != "connected " ) {
102
+ $ call = $ call . "2>&1 " ;
103
+ $ return_message = shell_exec ($ call );
104
+ $ data = json_decode ($ return_message ,true );
105
+ if ($ data ["state " ] != "connected " ) {
122
106
throw new LocalException ($ data ['message ' ]);
123
107
}
124
108
$ this ->pid = $ data ['pid ' ];
@@ -127,7 +111,7 @@ public function start($arguments) {
127
111
public function stop () {
128
112
fclose ($ this ->loghandle );
129
113
$ call = $ this ->stop_command ();
130
- system ("$ call " );
114
+ shell_exec ("$ call " );
131
115
}
132
116
133
117
public function start_command () {
0 commit comments