@@ -51,13 +51,10 @@ public function start($ip, $port, $path, $logsPath, $debug, $expectationsPath)
5151 {
5252 $ phiremockPath = is_file ($ path ) ? $ path : $ path . DIRECTORY_SEPARATOR . 'phiremock ' ;
5353 $ expectationsPath = is_dir ($ expectationsPath ) ? $ expectationsPath : '' ;
54-
55- $ this ->initProcess ($ ip , $ port , $ debug , $ expectationsPath , $ phiremockPath );
56- $ this ->logPhiremockCommand ($ debug );
5754 $ logFile = $ logsPath . DIRECTORY_SEPARATOR . self ::LOG_FILE_NAME ;
58- $ this ->process -> start ( function ( $ type , $ buffer ) use ( $ logFile ) {
59- file_put_contents ( $ logFile , $ buffer , FILE_APPEND );
60- } );
55+ $ this ->initProcess ( $ ip , $ port , $ debug , $ expectationsPath , $ phiremockPath , $ logFile );
56+ $ this -> logPhiremockCommand ( $ debug );
57+ $ this -> process -> start ( );
6158 }
6259
6360 /**
@@ -74,8 +71,9 @@ public function stop()
7471 * @param bool $debug
7572 * @param string $expectationsPath
7673 * @param string $phiremockPath
74+ * @param string $logFile
7775 */
78- private function initProcess ($ ip , $ port , $ debug , $ expectationsPath , $ phiremockPath )
76+ private function initProcess ($ ip , $ port , $ debug , $ expectationsPath , $ phiremockPath, $ logFile )
7977 {
8078 $ commandline = [
8179 $ this ->getCommandPrefix () . $ phiremockPath ,
@@ -91,8 +89,10 @@ private function initProcess($ip, $port, $debug, $expectationsPath, $phiremockPa
9189 $ commandline [] = '-e ' ;
9290 $ commandline [] = $ expectationsPath ;
9391 }
92+ $ commandline [] = '> ' ;
93+ $ commandline [] = $ logFile ;
94+ $ commandline [] = '2>&1 ' ;
9495
95- // Process wraps the command with 'exec' in UNIX OSs.
9696 $ this ->process = new Process (implode (' ' , $ commandline ));
9797 }
9898
@@ -119,6 +119,6 @@ private function getCommandPrefix()
119119 */
120120 private function isWindows ()
121121 {
122- return PHP_OS === 'WIN32 ' || PHP_OS === ' WINNT ' || PHP_OS === ' Windows ' ;
122+ return DIRECTORY_SEPARATOR === '\\ ' ;
123123 }
124124}
0 commit comments