Purpose
Execute an
external program.
Synopsis
procedure system(command:string|text)
procedure system(command:string|text,...)
procedure system(command:string|text,args:list)
Arguments
command
|
The command to be executed
|
args
|
List containing the arguments for the command
|
Example
The following displays the functionality of the
mmsystem and
mmjobs modules using the program
mosel:
system('mosel exam mmsystem"')
system('mosel','exam','mmjobs')
Further information
1. The given program is executed directly: if the specified expression is a shell command, it is necessary to call the shell explicitly. For instance to get a directory listing under Windows the command will be
"cmd /C dir".
2. Using this procedure should be avoided in applications that are to be run on different systems because such a call is always system dependent and may not be portable.
3. The generated process inherits the current system environment plus the environment variables modified/created using the
setenv procedure.
4. On Windows the program to execute is located using the current process environment, as a consequence any modification of the
PATH environment variable or working directory has no effect on finding this executable. The behaviour is different on Posix systems where the search for the program to execute is performed from the subprocess environment.
5. The default output and error streams of the generated process are redirected to the corresponding Mosel streams. The default input stream is closed.
7. When Mosel is running in restricted mode (see Section
mosel command: restricted mode), the restriction
NoExec disables this routine unless the environment variable
MOSEL_EXECPATH
is defined. This variable, used in a similar way as the
PATH environment variable, gives a list of paths than can still be used under the restriction. In addition to directories, the definition of the variable may include paths to executables such that it may directly specify a list of programs. It is also worth noting that no search is performed (
i.e. executables must be given with their full path) and that path expansion is performed a the time of loading
mmsystem relative to the Mosel initial working directory.
9. When using the second and third forms of the procedure the command and each element of the list of arguments are taken individually. This can be helpful if the command or the arguments contain spaces or special characters (they should be quoted appropriately when using the procedure with a single argument).
10. The status of the execution is reported by
getsysstat that returns the exit code of the program, a status of 0 indicates a normal termination. If the program could not be started (typically because the system could not find it) the returned status is 255. Moreover a status of
MAX_INT characterises an error that occurred before trying to start the program and a status of
-MAX_INT will be returned if execution is disabled because of restrictions.
11. On Posix systems, a negative execution status will be returned if the process has been terminated because of a signal. The status code corresponds to the signal number.
Related topics
Module
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the
property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not
convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except
solely for internal evaluation purposes to determine whether to purchase a license to the software
described in this documentation, or as otherwise set forth in a written software license agreement
between you and FICO (or a FICO affiliate). Use of this documentation and the software described in
it must conform strictly to the foregoing permitted uses, and no other use is permitted.