Executing sub-programs from a parent program with RUN

Sub-programs can be executed from a parent program with the RUN instruction.

There can be limitations, as the GWA runs in the browser:

  1. GUI type program: A sub-program typically should be a graphical (UI) application because browsers often kill non-GUI background processes that run for several seconds. If a non-GUI sub-program runs longer than about 5 seconds it may be terminated, so you should present a GUI progress indicator and refresh it regularly (at least once per second) to keep the browser from stopping the process.
  2. Environment inheritance: The sub-program will inherit the environment of the parent program.
  3. File system sharing : The child programs can access some files in the parent app's filesystem: /app, /tmp, and /home/packdir directory (which can be queried via fgl_getenv(HOME)). However, directories created by the parent program with files under a new root, for example os.Path.mkdir("/mypath") are not shared.

The RUN instruction takes a shell command as parameter. To start another BDL program from the current program, specify fglrun, followed by the program name and arguments.

As the GWA runs in the browser, there is no real shell, so the RUN instruction can only start an fglrun command:
RUN "fglrun prog-name [arg [,...]]" 
 [ RETURNING variable | WITHOUT WAITING ]

For more details, see the reference page of the RUN instruction.