Debian Developers - [OT] Prevent keyboard interrupt (C / Python)

This is Interesting: Free IT Magazines  
Home > Archive > Debian Developers > March 2004 > [OT] Prevent keyboard interrupt (C / Python)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [OT] Prevent keyboard interrupt (C / Python)
Andreas Tille

2004-03-13, 10:34 am

Hi,

sorry - this is not obviousely Debian related but I guess somebody
can quickly help me here.

1. How can I prevent that a C-program (console based) can be
interupted by pressing ^C?
2. How can I prevent that a Python script can be interupted by
pressing ^C?
3. How can I prevent a bash script can be interupted by pressing ^C?

Thanks and sorry for beeing off topic

Andreas.


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Clint Adams

2004-03-13, 10:34 am

In all three cases you want to ignore SIGINT.

> 1. How can I prevent that a C-program (console based) can be


signal(SIGINT,SIG_IGN);

> interupted by pressing ^C?
> 2. How can I prevent that a Python script can be interupted by
> pressing ^C?


import signal

signal.signal(signal.SIGINT, signal.SIG_IGN)

> 3. How can I prevent a bash script can be interupted by pressing ^C?


trap "" INT


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Raúl Alexis Betancort Santana

2004-03-13, 11:34 am

El Sat, Mar 13, 2004 at 04:10:20PM +0100, Andreas Tille escribió:
> Hi,
>
> sorry - this is not obviousely Debian related but I guess somebody
> can quickly help me here.
>
> 1. How can I prevent that a C-program (console based) can be
> interupted by pressing ^C?


man 2 signal

> 2. How can I prevent that a Python script can be interupted by
> pressing ^C?


pydoc signal

> 3. How can I prevent a bash script can be interupted by pressing ^C?


man bash, lookup for "trap"

Have fun!! ..
--
_ _
// Raúl A. Betancort Santana /> A Dream is an answer to __ \\
// <rabs@dimension-virtual.com> // question that we don't know (oo) \\
// Dimensión Virtual S.L. // how to ask. / \/ \ //
\> A Linux Solution Provider </ `V__V' </


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com