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

Bryan Kearney bkearney at redhat.com
Tue Dec 9 12:48:22 UTC 2008


Jim Meyering wrote:
> 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).
The goal was to allow a user to ctrl-c out of the standalone node 
scripts and get back to the main menu. We were not able to get the 
scripts to recognize INTR in the init process so I believe Darryl 
decided to abandondon this.

-- bk




More information about the ovirt-devel mailing list