Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

sys logging tweaks and better error handling around the main run loop

  • Loading branch information...
commit b5afea78b06a163dec8b5e0993a02afdd2f54763 1 parent ed5baf9
Kevin Olbrich authored
Showing with 16 additions and 6 deletions.
  1. +16 −6 lib/Cuke4Php.php
View
22 lib/Cuke4Php.php
@@ -26,7 +26,7 @@ class Cuke4Php {
);
function __construct($_sFeaturePath, $_iPort = 16816) {
- openlog("cuke4php", 0, LOG_DAEMON);
+ openlog("cuke4php", LOG_PID, LOG_DAEMON);
if (is_file($_sFeaturePath)) {
$_sFeaturePath = dirname($_sFeaturePath);
}
@@ -137,10 +137,20 @@ function run() {
}
}
} catch (Exception $e) {
- if (socket_last_error($connection) != 54) {
- syslog(LOG_ERR,$e->getMessage());
- throw $e;
- };
+ switch (socket_last_error($connection)) {
+ case 54:
+ // connection closed by peer
+ case 104:
+ // unable to read from socket
+ // these errors just mean we are done and the connection should be closed.
+ // it does not mean we should stop listening for new connections.
+ break;
+
+ default:
+ syslog(LOG_ERR,$e->getMessage());
+ throw $e;
+ break;
+ }
}
socket_close($connection);
syslog(LOG_INFO,"Connection closed");
@@ -193,7 +203,7 @@ function process($sInput) {
* run any before hooks for a scenario
*/
function beginScenario($aTags) {
- syslog(LOG_DEBUG,"Begin Scenario");
+ syslog(LOG_DEBUG,"Begin Scenario: Tags: " . implode(", ", $aTags));
$this->setScenario(CucumberScenario::getInstance($this->aWorld));
return $this->oScenario->invokeBeforeHooks($aTags);
}
Please sign in to comment.
Something went wrong with that request. Please try again.