File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,18 @@ private function execute()
3636 throw new RuntimeException ('Failed to execute command (no stdout stream): ' .$ this ->command );
3737 }
3838
39+ $ this ->readStreams ($ stdout , $ stderr );
40+ }
41+
42+ private function readStreams ($ stdout , $ stderr )
43+ {
3944 $ startTime = time ();
4045
4146 do {
42- $ this ->error = fread ($ stderr , self ::STREAM_BYTES_PER_READ );
4347 $ this ->output = fread ($ stdout , self ::STREAM_BYTES_PER_READ );
48+ $ this ->error = fread ($ stderr , self ::STREAM_BYTES_PER_READ );
4449
45- $ streamsComplete = (feof ($ stderr ) && feof ($ stdout ));
50+ $ streamsComplete = (feof ($ stdout ) && feof ($ stderr ));
4651
4752 if (!$ streamsComplete ) {
4853 // Prevent thrashing.
@@ -54,13 +59,23 @@ private function execute()
5459 } while ($ executionDuration <= self ::EXECUTION_TIMEOUT_SECONDS && !$ streamsComplete );
5560 }
5661
57- public function getOutput (): string
62+ public function getRawOutput (): string
5863 {
5964 return $ this ->output ;
6065 }
6166
62- public function getError (): string
67+ public function getRawError (): string
6368 {
6469 return $ this ->error ;
6570 }
71+
72+ public function getOutput (): string
73+ {
74+ return trim ($ this ->getRawOutput ());
75+ }
76+
77+ public function getError (): string
78+ {
79+ return trim ($ this ->getRawError ());
80+ }
6681}
You can’t perform that action at this time.
0 commit comments