Difference between revisions of "SPAWN"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
=SPAWN=
 
 
 
 
==Class==
 
==Class==
 
Disk and File Utilities
 
Disk and File Utilities
Line 29: Line 26:
 
pid = spawnpid()
 
pid = spawnpid()
 
on escape killed = cancelpid(pid)
 
on escape killed = cancelpid(pid)
if .not. activepid(pid)
+
if not activepid(pid)
set message to "Printing completed."
+
    set message to "Printing completed."
 
endif
 
endif
 
</code>
 
</code>
Line 39: Line 36:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Disk and File Utilities]]
 +
[[Category:Disk and File Utilities Commands]]

Revision as of 14:43, 4 June 2009

Class

Disk and File Utilities


Purpose

Execute an external program and optionally wait for its completion


Syntax

SPAWN | !! <os-command>


See Also

ACTIVEPID(), CANCELPID(), SPAWNPID()


Description

The SPAWN command is synonymous with the !! command. These commands provide the facility for executing external programs, in the 'background', from within the Recital/4GL. The SPAWN command differs from the RUN command in that the specified <os command> executes in parallel without waiting until command execution is complete. It is particularly useful for generating reports from shared tables. When running a command in the background, terminal output is disabled for the background command if it is running the Recital/4GL.

The SPAWNPID() function returns the identity of the spawned process. The ACTIVEPID(<pid>) function returns .T. if the specified process is still active and .F. otherwise. The CANCELPID(<pid>) function returns .T. if the specified process could be 'killed' and .F. otherwise. A spawned process will only remain active while the user remains logged in. All spawned processes will be terminated when the user logs out.


Example

spawn db printrep
pid = spawnpid()
on escape killed = cancelpid(pid)
if not activepid(pid)
    set message to "Printing completed."
endif


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer