Skip to content

Commit e3458d4

Browse files
Arkadiy Kukarkindanhunsaker
authored andcommitted
Cleaner PIDFILE success check
- Use `if` instead of logic operators - Check for `false` explicitly
1 parent 333e545 commit e3458d4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

bin/resque

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ if($count > 1) {
130130

131131
$PIDFILE = getenv('PIDFILE');
132132
if ($PIDFILE) {
133-
file_put_contents($PIDFILE, getmypid()) or (
134-
$logger->log(Psr\Log\LogLevel::NOTICE, 'Could not write PID information to {pidfile}', array('pidfile' => $PIDFILE)) and
135-
die(2)
136-
);
133+
if(file_put_contents($PIDFILE, getmypid()) === false){
134+
$logger->log(Psr\Log\LogLevel::NOTICE, 'Could not write PID information to {pidfile}', array('pidfile' => $PIDFILE));
135+
die(2);
136+
}
137137
}
138138

139139
$registered = TRUE;
@@ -175,10 +175,10 @@ else {
175175

176176
$PIDFILE = getenv('PIDFILE');
177177
if ($PIDFILE) {
178-
file_put_contents($PIDFILE, getmypid()) or (
179-
$logger->log(Psr\Log\LogLevel::NOTICE, 'Could not write PID information to {pidfile}', array('pidfile' => $PIDFILE)) and
180-
die(2)
181-
);
178+
if(file_put_contents($PIDFILE, getmypid()) === false) {
179+
$logger->log(Psr\Log\LogLevel::NOTICE, 'Could not write PID information to {pidfile}', array('pidfile' => $PIDFILE));
180+
die(2);
181+
}
182182
}
183183

184184
$logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', array('worker' => $worker));

0 commit comments

Comments
 (0)