Consultor Eletrônico



Kbase P112720: Error 140 with OUTPUT THROUGH on a "fast" machine.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   20/12/2010
Status: Verified

SYMPTOM(s):

4GL program fails with error 140

** Pipe to subprocess has been broken. (140)

Error 140 appears after the OUTPUT CLOSE statement.

FACT(s) (Environment):

4GL program uses the OUTPUT THROUGH statement.
There is little code between the OUTPUT THROUGH and the OUTPUT CLOSE statements.
Such code is executed very quickly by the machine.
UNIX
Progress 9.x
OpenEdge 10.x

CAUSE:

This is a timing issue: the code between OUTPUT THROUGH and OUTPUT CLOSE runs so quickly that the OUTPUT CLOSE statement is reached before the OS has fully spawned the process to which the OUTPUT THROUGH is supposed to communicate. For example:

OUTPUT THROUGH lpr.
PUT UNFORMATTED " Very quick report." .
OUTPUT CLOSE.

This can be a problem especially for faster machines.

FIX:

Slow the Progress session down by adding, for example, a PAUSE 1 statement after OUTPUT THROUGH:

OUTPUT THROUGH lpr.
PAUSE 1 NO-MESSAGE.
PUT UNFORMATTED " Very quick report." .
OUTPUT CLOSE.

This gives the OS time to spawn the process [lpr, in the example] successfully, and to establish the communication pipes between that process and the Progress session.