\r
#include <timer.h>\r
#include <command.h>\r
-\r
+#include <unit.h>\r
\r
\r
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);\r
{\r
ttimer_t timer;\r
\r
- /* TODO : check the parameter */\r
- \r
timer = xbt_new0(s_timer_t, 1);\r
\r
timer->command = command;\r
int\r
timer_free(ttimer_t* ptr)\r
{\r
- /* TODO : check the parameter */\r
- \r
+ if((*ptr)->started)\r
+ xbt_os_sem_destroy((*ptr)->started);\r
+\r
free(*ptr);\r
+\r
*ptr = NULL;\r
\r
return 0;\r
\r
if(timer->timeouted && !command->failed && !command->successeded && !command->interrupted)\r
{\r
- error_register("Command timed out", ECMDTIMEDOUT, command->context->command_line, command->unit->fstream->name);\r
+ ERROR3("[%s] `%s' timed out after %d sec", command->context->pos, command->context->command_line, command->context->timeout);\r
+\r
+\r
+ unit_set_error(command->unit, ECMDTIMEDOUT, 1);\r
+\r
command_kill(command);\r
command_handle_failure(command, csr_timeout);\r
- \r
- \r
+\r
+ while(!command->reader->done)\r
+ xbt_os_thread_yield();\r
+\r
+ if(command->output->used)\r
+ INFO2("[%s] Output on timeout:\n%s",command->context->pos, command->output->data);\r
+ else\r
+ INFO1("[%s] No output before timeout",command->context->pos);\r
}\r
\r
return NULL;\r