Difference between revisions of "SPAWN"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=SPAWN=
 
 
 
==Class==
 
Disk and File Utilities
 
 
 
 
==Purpose==
 
==Purpose==
 
Execute an external program and optionally wait for its completion
 
Execute an external program and optionally wait for its completion
Line 29: Line 22:
 
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 36: Line 29:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Disk and File Utilities]]
 +
[[Category:Disk and File Utilities Commands]]

Latest revision as of 16:04, 25 November 2009

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 Server, Recital