Question How to distinguish signals within a Progress session?

There are two signals that we can control our response to inside a Progress session:
SIGINT (2) - Terminal interrupt signal. = Ctrl-C
SIGPIPE (13) - Write on a pipe with no one to read it.

The SIGPIPE signal causes a session to issue the message 140:
** Pipe to subprocess has been broken. (140)

Is it possible to catch this message inside the session?

Test:
mpro –p signal.p –zp
where signal.p:

Code:
DO ON STOP UNDO, RETRY:
  IF RETRY THEN
  DO:
     MESSAGE _MSG(1) SKIP
     ERROR-STATUS:NUM-MESSAGES
     ERROR-STATUS:GET-MESSAGE(1)
     VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
     QUIT.
  END.
 
  MESSAGE "Send me a signal (-2 or -13)." VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
END.
Both SIGINT and SIGPIPE signals put the message 115 to a message stack (“Press space bar to continue.”). In both cases it’s the only change.
But the message 140 is also a Progress message. Is it possible to catch it?

The goal is to have more options for interacting with background processes.
 
Isn't there a way to get the last few error messages?

There appear to be two error message stacks:
Code:
&SCOPED-DEFINE MaxNumber 32767
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE e AS CHARACTER NO-UNDO.

/* Put a message in the message stack */
ASSIGN _MSG = {&MaxNumber}.

/* without NO-ERROR - in the stack: */
DO ON ERROR UNDO, LEAVE:
 ASSIGN i = INTEGER("ERROR").
END.

/* with NO-ERROR - not in stack: */
ASSIGN e = ENTRY(2, "") NO-ERROR.
MESSAGE ERROR-STATUS:GET-MESSAGE(1)
VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.

/* Read the message stack: */
REPEAT i = 1 TO 26:
  DISPLAY i _MSG(i).
  IF _MSG(i) EQ {&MaxNumber} THEN
  LEAVE.
END.

There are only 25 entries in message stack:
Code:
DEFINE VARIABLE i AS INTEGER NO-UNDO.

DO i = 100 TO 1 BY -1:
  ASSIGN _MSG = i.
END.

REPEAT i = 1 TO 100:
  DISPLAY i _MSG(i).
  IF _MSG(i) EQ 0 THEN
  LEAVE.
END.

Offtop:
The message number is a short integer - the numbers higher than 32,767 become negative.
There are more than 21,000 messages in V13 and more than 25,000 message fragments.
 
Last edited:
Back
Top