Suppress the error message about a signal interrupt in cursor mode in all but the first instance in a pipeline (#187).
This commit is contained in:
+27
-1
@@ -43,6 +43,13 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Flag to allow reporting of "interrupted by signal" errors - cleared in
|
||||
* secondary instances in a pipeline, so that only one will report them.
|
||||
*/
|
||||
static bool pv__allow_signal_interrupt_reporting = true;
|
||||
|
||||
|
||||
/*
|
||||
* Create a per-euid, per-tty, lock file in ${TMPDIR:-${TMP:-/tmp}} for the
|
||||
* tty on the given file descriptor.
|
||||
@@ -360,6 +367,14 @@ static int pv_crs_ipcinit(pvcursorstate_t cursor, readonly_pvcontrol_t control,
|
||||
cursor->shared->tty_tostop_added = false;
|
||||
cursor->y_lastread = cursor->y_start;
|
||||
debug("%s", "we are the first to attach");
|
||||
} else {
|
||||
/*
|
||||
* Another process was first, so prevent the current
|
||||
* instance from reporting "interrupted by signal" errors
|
||||
* since the first one will do that.
|
||||
*/
|
||||
debug("%s", "not the first to attach - clearing pv__allow_signal_interrupt_reporting");
|
||||
pv__allow_signal_interrupt_reporting = false;
|
||||
}
|
||||
|
||||
cursor->y_offset = cursor->pvcount - 1;
|
||||
@@ -440,7 +455,7 @@ void pv_crs_init(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransie
|
||||
|
||||
#ifdef ECHOCTL
|
||||
/*
|
||||
* If the terminal ECHCTL attribute was already cleared by this
|
||||
* If the terminal ECHOCTL attribute was already cleared by this
|
||||
* process, set the flag in shared memory to let the other instances
|
||||
* know.
|
||||
*/
|
||||
@@ -750,3 +765,14 @@ void pv_crs_fini(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Report a signal interrupt, unless the flag allowing it has been cleared
|
||||
* due to another instance already taking responsibility.
|
||||
*/
|
||||
void pv_report_signal_interrupt(void)
|
||||
{
|
||||
if (pv__allow_signal_interrupt_reporting)
|
||||
pv_error("%s", _("interrupted by signal"));
|
||||
}
|
||||
|
||||
+4
-3
@@ -31,6 +31,7 @@
|
||||
|
||||
int pv_remote_transferstate_fetch(pvstate_t, pid_t, /*@null@ */ off_t *, bool);
|
||||
void pv_end_display(void);
|
||||
void pv_report_signal_interrupt(void);
|
||||
|
||||
|
||||
#if HAVE_SQRTL
|
||||
@@ -777,7 +778,7 @@ int pv_main_loop(pvstate_t state)
|
||||
|
||||
if (1 == state->flags.trigger_exit) {
|
||||
state->status.exit_status |= PV_ERROREXIT_SIGNAL;
|
||||
pv_error("%s", _("interrupted by signal"));
|
||||
pv_report_signal_interrupt();
|
||||
}
|
||||
|
||||
return state->status.exit_status;
|
||||
@@ -1324,7 +1325,7 @@ int pv_watchfd_loop(pvstate_t state)
|
||||
*/
|
||||
if (1 == state->flags.trigger_exit) {
|
||||
state->status.exit_status |= PV_ERROREXIT_SIGNAL;
|
||||
pv_error("%s", _("interrupted by signal"));
|
||||
pv_report_signal_interrupt();
|
||||
}
|
||||
|
||||
/* Free all allocated sub-structures. */
|
||||
@@ -1468,7 +1469,7 @@ int pv_query_loop(pvstate_t state, pid_t query)
|
||||
|
||||
if (1 == state->flags.trigger_exit) {
|
||||
state->status.exit_status |= PV_ERROREXIT_SIGNAL;
|
||||
pv_error("%s", _("interrupted by signal"));
|
||||
pv_report_signal_interrupt();
|
||||
}
|
||||
|
||||
return state->status.exit_status;
|
||||
|
||||
Reference in New Issue
Block a user