* Handle Control-C exception more cleanly

This commit is contained in:
peter 2005-02-15 19:15:45 +00:00
parent 482d781af3
commit 2ec108a9c7
3 changed files with 42 additions and 9 deletions

View File

@ -75,7 +75,7 @@ Function CatchSignal(Sig : longint):longint;
begin begin
case Sig of case Sig of
SIGINT : SIGINT :
raise Exception.Create('Ctrl-C Signaled!'); raise EControlCAbort.Create;
end; end;
{$ifndef unix} {$ifndef unix}
CatchSignal:=0; CatchSignal:=0;
@ -94,7 +94,10 @@ end.
{ {
$Log$ $Log$
Revision 1.23 2005-02-14 17:13:06 peter Revision 1.24 2005-02-15 19:15:45 peter
* Handle Control-C exception more cleanly
Revision 1.23 2005/02/14 17:13:06 peter
* truncate log * truncate log
Revision 1.22 2005/01/31 21:30:56 olle Revision 1.22 2005/01/31 21:30:56 olle

View File

@ -410,12 +410,18 @@ begin
end; end;
except except
on EControlCAbort do
begin
Message(general_e_compilation_aborted);
DoneVerbose;
end;
on Exception do
begin
Message(general_e_compilation_aborted); Message(general_e_compilation_aborted);
DoneVerbose; DoneVerbose;
Raise; Raise;
end; end;
end;
{$ifdef SHOWUSEDMEM} {$ifdef SHOWUSEDMEM}
{$ifdef HASGETHEAPSTATUS} {$ifdef HASGETHEAPSTATUS}
GetHeapStatus(hstatus); GetHeapStatus(hstatus);
@ -435,7 +441,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.56 2005-02-14 17:13:06 peter Revision 1.57 2005-02-15 19:15:45 peter
* Handle Control-C exception more cleanly
Revision 1.56 2005/02/14 17:13:06 peter
* truncate log * truncate log
Revision 1.55 2005/02/13 20:11:16 peter Revision 1.55 2005/02/13 20:11:16 peter

View File

@ -27,6 +27,7 @@ unit verbose;
interface interface
uses uses
sysutils,
cutils, cutils,
globals,finput, globals,finput,
cmsgs; cmsgs;
@ -67,6 +68,11 @@ interface
const const
msgfilename : string = ''; msgfilename : string = '';
type
EControlCAbort=class(Exception)
constructor Create;
end;
procedure SetRedirectFile(const fn:string); procedure SetRedirectFile(const fn:string);
function SetVerbosity(const s:string):boolean; function SetVerbosity(const s:string):boolean;
procedure PrepareReport; procedure PrepareReport;
@ -106,6 +112,7 @@ interface
procedure DoneVerbose; procedure DoneVerbose;
implementation implementation
uses uses
@ -114,6 +121,17 @@ implementation
var var
compiling_module : tmodulebase; compiling_module : tmodulebase;
{****************************************************************************
Control-C Exception
****************************************************************************}
constructor EControlCAbort.Create;
begin
inherited Create('Ctrl-C Signaled!');
end;
{**************************************************************************** {****************************************************************************
Extra Handlers for default compiler Extra Handlers for default compiler
****************************************************************************} ****************************************************************************}
@ -876,7 +894,10 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.38 2005-02-14 17:13:09 peter Revision 1.39 2005-02-15 19:15:45 peter
* Handle Control-C exception more cleanly
Revision 1.38 2005/02/14 17:13:09 peter
* truncate log * truncate log
Revision 1.37 2005/02/07 17:25:28 peter Revision 1.37 2005/02/07 17:25:28 peter