[Ovirt-devel] [PATCH node] Allow the init scripts to handle ctrl-c well

Jim Meyering jim at meyering.net
Mon Dec 8 17:57:25 UTC 2008


Bryan Kearney <bkearney at redhat.com> wrote:
> From: Bryan Kearney <bkearney at localhost.localdomain>
>
> ---
>  scripts/ovirt-functions |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
> index c6a8504..f641ea0 100644
> --- a/scripts/ovirt-functions
> +++ b/scripts/ovirt-functions
> @@ -2,6 +2,13 @@
>
>  OVIRT_LOGFILE=/var/log/ovirt.log
>
> +# handle ctrl-c gracefully
> +trap 'dropout' INT
> +
> +dropout() {
> +    exit 0
> +}

Hi Bryan,

What's the motivation for this addition?
It would make it so interrupting any script that sources
ovirt-functions would cause it to exit _successfully_.
And if some other program examines the script's exit status
(like Make or another shell script), then it will be misled
into thinking that the interrupted script succeeded.

Even changing it to exit nonzero would be misleading, since
that would hide the fact that the script had been terminated
by a signal (which is normally indicated via the exit status).




More information about the ovirt-devel mailing list