rendered paste bodydiff -u -p -u -r1.108 halcmd.c
--- src/hal/utils/halcmd.c 16 Jan 2007 06:50:27 -0000 1.108
+++ src/hal/utils/halcmd.c 17 Jan 2007 02:56:04 -0000
@@ -2211,8 +2211,18 @@ static int do_loadusr_cmd(char *args[])
struct timespec ts = {0, 10 * 1000 * 1000};
nanosleep(&ts, NULL);
- /* check for program ending without ever becoming ready */
+ /* check for program ending without ever becoming ready */
retval = waitpid( pid, &status, WNOHANG );
+
+ /* check for program becoming ready */
+ rtapi_mutex_get(&(hal_data->mutex));
+ comp = halpr_find_comp_by_name(new_comp_name);
+ if(comp && comp->ready) {
+ ready = 1;
+ }
+ rtapi_mutex_give(&(hal_data->mutex));
+
+ /* process the exit value, if any */
if ( retval < 0 ) {
if (count >= 100) {
fprintf(stderr, "\n");
@@ -2225,19 +2235,13 @@ static int do_loadusr_cmd(char *args[])
if (count >= 100) {
fprintf(stderr, "\n");
}
- rtapi_print_msg(RTAPI_MSG_ERR,
- "HAL:%d: ERROR: %s exited without becoming ready\n", linenumber, prog_name);
- return -1;
+ if(!ready) {
+ rtapi_print_msg(RTAPI_MSG_ERR,
+ "HAL:%d: ERROR: %s (%s) exited without becoming ready\n", linenumber, prog_name, new_comp_name);
+ return -1;
+ }
}
- /* check for program becoming ready */
- rtapi_mutex_get(&(hal_data->mutex));
- comp = halpr_find_comp_by_name(new_comp_name);
- if(comp && comp->ready) {
- ready = 1;
- }
- rtapi_mutex_give(&(hal_data->mutex));
-
- count++;
+ count++;
if(count == 100) {
fprintf(stderr, "Waiting for component '%s' to become ready.",
new_comp_name);