Make sure that the Last Words of a dead exe are preserved for future generations.

SVN revision: 19140
This commit is contained in:
David Walter Seikel 2005-12-19 05:07:58 +00:00
parent 82a7db1987
commit f1ecb69e85
3 changed files with 25 additions and 12 deletions

View File

@ -771,7 +771,16 @@ _ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler)
}
}
if (lost_exe)
ecore_exe_terminate(exe);
{
if (exe->exit_event)
{
_ecore_event_add(ECORE_EVENT_EXE_EXIT, exe->exit_event,
_ecore_event_exe_exit_free, NULL);
exe->exit_event = NULL; /* Just being paranoid. */
}
else
ecore_exe_terminate(exe); /* FIXME: give this some deep thought later. */
}
break;
}
}

View File

@ -152,13 +152,20 @@ struct _Ecore_Exe
Ecore_Exe_Flags flags;
Ecore_Fd_Handler *write_fd_handler; /* the fd_handler to handle write to child - if this was used, or NULL if not */
Ecore_Fd_Handler *read_fd_handler; /* the fd_handler to handle read from child - if this was used, or NULL if not */
void *write_data_buf; /* a data buffer for data to write to the child - realloced as needed for more data and flushed when the fd handler says writes are possible */
void *write_data_buf; /* a data buffer for data to write to the child -
* realloced as needed for more data and flushed when the fd handler says writes are possible
*/
int write_data_size; /* the size in bytes of the data buffer */
int write_data_offset; /* the offset in bytes in the data buffer */
void *read_data_buf; /* data read from the child awating delivery to an event */
int read_data_size; /* data read from child in bytes */
int child_fd_write; /* fd to write TO to send data to the child */
int child_fd_read; /* fd to read FROM when child has sent us (the parent) data */
/* I thought a bit about wether or not their could be multiple exit events, then realised that since we
* delete the exe on the first exit event, the answer is no. On the other hand, STOPing an exe may trigger
* this, even though it has not truly exited. Probably should investigate this further.
*/
struct _Ecore_Event_Exe_Exit *exit_event; /* Process exit event */
};
#endif

View File

@ -161,14 +161,8 @@ _ecore_signal_call(void)
{
Ecore_Event_Exe_Exit *e;
/* FIXME: If this process is set to read from the child, DELAY
* the exe event until the pipe from the child dies and reports
* errors - THEN report and exe - so store this exe value in the
* ecore_exe struct waiting for the read fd to die then report
* final read data, THEN this exit event
*
* If this process is set respawn, respawn with a suitable backoff
* for those that need too much respawning.
/* FIXME: If this process is set respawn, respawn with a suitable backoff
* period for those that need too much respawning.
*/
e = _ecore_event_exe_exit_new();
if (e)
@ -187,9 +181,12 @@ _ecore_signal_call(void)
e->exe = _ecore_exe_find(pid);
if (sigchld_info.si_signo)
e->data = sigchld_info;
e->data = sigchld_info; /* FIXME: I'm not sure, but maybe we should clone this. I don't know if anybody uses it. */
_ecore_event_add(ECORE_EVENT_EXE_EXIT, e,
if ((e->exe) && (e->exe->flags & ECORE_EXE_PIPE_READ))
e->exe->exit_event = e; /* We want to report the Last Words of the exe, so delay this event. */
else
_ecore_event_add(ECORE_EVENT_EXE_EXIT, e,
_ecore_event_exe_exit_free, NULL);
}
}