On 7/17/25 10:10 PM, andy pugh wrote:
You need to change the '-W' into '-w' (lower case 'w'). That should
I will try that, though I am currently unclear what sends the EXIT
I tried this, and it doesn't work as the HAL file just sits there
waiting for the component to exit, but there is no exit command, so it
waits indefinitely.

That is interesting. So, why/how does mb2hal exit...

What I do know is that the -W flag only checks the HAL ready state of the component. That is done in line 85 of hal/user_comps/mb2hal/mb2hal.c

So, if you do not see everything up to the message "HAL components created OK" (right after hal_ready() call), then you are seeing the consequences of the race-condition and buffering of the output.

The only way for mb2hal to exit is that it receives a SIGTERM or SIGINT (it says SIGQUIT in the code, but the signal() call is attached to SIGINT). My guess is that a halcmd is issued to stop hal, somewhere.

But this does not resolve the race. For that you need to be sure that mb2hal exited /before/ you run the checkresult diff. Maybe it should simply test whether it is still alive and add the following snippet to the beginning of the checkresult script:
------
# Prevent a race - mb2hal will exit, but that takes time.
# Wait until it is no longer in the process list or error if waiting
# takes too long.
TIMEOUT=0
while ps ax | grep -w mb2hal | grep -q -v grep; do
  if [ $TIMEOUT -ge 30 ]; then
    echo "Timeout waiting for mb2hal to exit" >> /dev/stderr
    exit 1
  fi
  sleep 1
  TIMEOUT=$((TIMEOUT + 1))
done
------

Then it will wait until mb2hal is done, but no longer than about 30 seconds or so.

--
Greetings Bertho

(disclaimers are disclaimed)



_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to