How to avoid control-c killing the open program?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
phhs80
Newbie
Newbie
Posts: 4
Joined: Thu Jul 23, 2009 7:32 am

How to avoid control-c killing the open program?

Post by phhs80 »

Dear All,

When I am running a program under Wine and I press Control-C, the running program is killed. However, this behavior is not always the desired one. In truth, imagine that the program is doing some calculations that you want to interrupt; if one presses Control-C, the program is killed, but all one wanted was to interrupt the calculations and NOT killing the program. Is there some workaround?

Thanks in advance,

Paul
Frédéric Delanoy

How to avoid control-c killing the open program?

Post by Frédéric Delanoy »

On Thu, Jul 23, 2009 at 2:38 PM, phhs80<[email protected]> wrote:
Dear All,

When I am running a program under Wine and I press Control-C, the running program is killed. However, this behavior is not always the desired one. In truth, imagine that the program is doing some calculations that you want to interrupt; if one presses Control-C, the program is killed, but all one wanted was to interrupt the calculations and NOT killing the program. Is there some workaround?

Thanks in advance,

Paul
Well, if the program itself doesn't provide a way to cancel a
calculation, I don't see what wine could do... it doesn't (and
shouldn't) have intimate knowledge of every application...
Now, if you just want to suspend the program, you can use your
terminal suspend feature (Ctrl-Z generally) to suspend the whole
process

Frédéric
Martin Gregorie

How to avoid control-c killing the open program?

Post by Martin Gregorie »

On Thu, 2009-07-23 at 07:38 -0500, phhs80 wrote:
Dear All,

When I am running a program under Wine and I press Control-C, the
running program is killed. However, this behavior is not always the
desired one.
A Linux/UNIX program can catch Control-C and take any action it likes,
but it must be written to do that. The default action is to terminate
the process.

What does your program do when its run under Windows and you type
Control-C?


Martin
phhs80
Newbie
Newbie
Posts: 4
Joined: Thu Jul 23, 2009 7:32 am

Re: How to avoid control-c killing the open program?

Post by phhs80 »

Martin Gregorie wrote:On Thu, 2009-07-23 at 07:38 -0500, phhs80 wrote:
Dear All,

When I am running a program under Wine and I press Control-C, the
running program is killed. However, this behavior is not always the
desired one.
A Linux/UNIX program can catch Control-C and take any action it likes,
but it must be written to do that. The default action is to terminate
the process.

What does your program do when its run under Windows and you type
Control-C?


Martin
Thanks to both answers.

On Windows, when I press Control-C the calculations of the program are interrupted, but the program is not killed. That is, the key sequence to interrupt calculations is Control-C. I am talking about a program that runs in a console.

Paul
Martin Gregorie

How to avoid control-c killing the open program?

Post by Martin Gregorie »

On Thu, 2009-07-23 at 08:35 -0500, phhs80 wrote:
On Windows, when I press Control-C the calculations of the program are
interrupted, but the program is not killed. That is, the key sequence
to interrupt calculations is Control-C. I am talking about a program
that runs in a console.
In POSIX Control-C is assigned to SIGINT, which your program obviously
doesn't catch, and which defaults to terminating the program.

In Windows Control-C defaults to causing a type 23H DOS interrupt - at
least that's what my ancient Borland C 4.x manual says. The default
handler for a 23H interrupt returns zero (stop the program) but the
program can replace the ctrlbrk handler with one that does something
useful to it and then returns non-zero (let the program continue). As
this involves grabbing a hardware interrupt vector I would not be
surprised if Wine doesn't handle it properly.

This mechanism may well be different for the NT-based versions of
Windows so if you haven't tried doing so, what difference does it make
if you set Wine to emulate Win98?

That's as far as my knowledge extends. If setting Wine to Win98 mode
doesn't help, it might be a question for the devs.


Martin
austin987
Wine Developer
Wine Developer
Posts: 2383
Joined: Fri Feb 22, 2008 8:19 pm

How to avoid control-c killing the open program?

Post by austin987 »

On Thu, Jul 23, 2009 at 8:35 AM, phhs80<[email protected]> wrote:
Martin Gregorie wrote:
On Thu, 2009-07-23 at 07:38 -0500, phhs80 wrote:
Dear All,

When I am running a program under Wine and I press Control-C, the
running program is killed. However, this behavior is not always the
desired one.

A Linux/UNIX program can catch Control-C and take any action it likes,
but it must be written to do that. The default action is to terminate
the process.

What does your program do when its run under Windows and you type
Control-C?


Martin
Thanks to both answers.

On Windows, when I press Control-C the calculations of the program are interrupted, but the program is not killed. That is, the key sequence to interrupt calculations is Control-C. I am talking about a program that runs in a console.
It should work fine for a gui app. For console apps, it cancels the
console process. I'm not sure if there's a workaround or not. File a
bug (search for an open one first).

--
-Austin
phhs80
Newbie
Newbie
Posts: 4
Joined: Thu Jul 23, 2009 7:32 am

Re: How to avoid control-c killing the open program?

Post by phhs80 »

Martin Gregorie wrote: This mechanism may well be different for the NT-based versions of
Windows so if you haven't tried doing so, what difference does it make
if you set Wine to emulate Win98?
Thanks, Martin, for your reply. I have tried with Win98 emulation, but no progress.

Paul
phhs80
Newbie
Newbie
Posts: 4
Joined: Thu Jul 23, 2009 7:32 am

Re: How to avoid control-c killing the open program?

Post by phhs80 »

austin987 wrote: It should work fine for a gui app. For console apps, it cancels the
console process. I'm not sure if there's a workaround or not. File a
bug (search for an open one first).
Thanks, Austin, for your suggestion. I have just filed the following bug:

http://bugs.winehq.org/show_bug.cgi?id=19437

Paul
Locked