<p>Forking raises a race condition, where the parent might run the<br>
test before the child has had time to fork. If that happens,<br>
an error similar to this is produced:<br>
Failed test 'Output correct'<br>
at ./t/check_procs.t line 32.<br>
'PROCS OK: 0 processes with args 'sleep 7' | processes=0;;;0;'<br>
doesn't match '/^PROCS OK: 1 process?/'</p>
<p>Sleeping a bit should avoid the problem. It might be enough to<br>
sleep less than a second, but perl's built-in sleep function only<br>
supports integer seconds.</p>
<p>In our build environment, the build failed 3 of 4 times before<br>
this patch. After the patch it failed 0 of 7 times.</p>
<p>Signed-off-by: Mikael Falkvidd <a href="mailto:mfalkvidd@op5.com">mfalkvidd@op5.com</a></p>
<hr>
<h4>You can merge this Pull Request by running</h4>
<pre> git pull https://github.com/mfalkvidd/monitoring-plugins master</pre>
<p>Or view, comment on, or merge it at:</p>
<p> <a href='https://github.com/monitoring-plugins/monitoring-plugins/pull/1272'>https://github.com/monitoring-plugins/monitoring-plugins/pull/1272</a></p>
<h4>Commit Summary</h4>
<ul>
<li>check_procs: Add delay after forking in test</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/monitoring-plugins/monitoring-plugins/pull/1272/files#diff-0">plugins/t/check_procs.t</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/monitoring-plugins/monitoring-plugins/pull/1272.patch'>https://github.com/monitoring-plugins/monitoring-plugins/pull/1272.patch</a></li>
<li><a href='https://github.com/monitoring-plugins/monitoring-plugins/pull/1272.diff'>https://github.com/monitoring-plugins/monitoring-plugins/pull/1272.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br><a href="https://github.com/monitoring-plugins/monitoring-plugins/pull/1272">Reply to this email on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/5514713__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyMDYzOTAzNCwiZGF0YSI6eyJpZCI6MzY3Mjc0NDN9fQ==--048181dc5d6fb375e5498e6d1ba4cadeee5927a8.gif" width="1" /></p>