How to catch CTRL-C in Windows NT cmd.exe???

S

Solo

I wrote the following code just to test the catch of Ctrl-C:
---------------

{

$SIG{'INT'} = \&cmd1;


print "Entering the loop \n\n";
while (1)
{
}

}

sub cmd1
{
my ($sig) = @_;
print "The Interrupt was caught: <$sig>\n";
exit (0);
}
 
S

Sisyphus

Solo said:
I wrote the following code just to test the catch of Ctrl-C:
---------------

{

$SIG{'INT'} = \&cmd1;


print "Entering the loop \n\n";
while (1)
{
}

}

sub cmd1
{
my ($sig) = @_;
print "The Interrupt was caught: <$sig>\n";
exit (0);
}

--------------------
It works perfectly on UNIX, But in the windows NT cmd.exe or 4NT prompt, it
just kills the process and does not display the print message...

HELP!!!

It works fine for me in a cmd.exe shell on Windows 2000, and displays
the print message. Is that a copy'n'paste of the actual program that's
failing on NT ?

Cheers,
Rob
 
S

Solo

Sisyphus said:
It works fine for me in a cmd.exe shell on Windows 2000, and displays
the print message. Is that a copy'n'paste of the actual program that's
failing on NT ?

Cheers,
Rob


Yes, it's an actual cut'n'paste.....
 
S

Sisyphus

Solo said:
Yes, it's an actual cut'n'paste.....

So much for that idea then ...... :)
What does 'perl -V' report ?

Faik, the difference might be that you are running NT and I'm running
2000 - but, I've not come across such a difference between the 2
operating systems in the past.

Cheers,
Rob
 
S

Scott W Gifford

I wrote the following code just to test the catch of Ctrl-C:
---------------

{

$SIG{'INT'} = \&cmd1;

Try using $SIG{BREAK} instead. I recall that working for me, though I
don't recall where I read it.

----ScottG.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top