system - Maple Programming Help

system

invoke a command in the host operating system

 Calling Sequence system(command) system[launch](command,arguments)

Parameters

 command - string arguments - sequence of strings, and/or small integers

Description

 • The function system passes command to the host operating system which performs the appropriate function.
 The result is the return status of the command performed, which is operating system dependent, but usually 0 indicates success and any other value indicates failure.
 Note: On some operating systems, some operating system commands may not be accessible via this mechanism.
 • The function system[launch] spawns a new process before executing command via Windows' CreateProcess or Unix-style fork/exec system calls.  The given command should specify an application or executable file, not a shell or DOS command.
 The new process, as specified by command and zero or more arguments, is started outside Maple.  The Maple process continues as usual; it does not wait for the new process to finish.
 If an error occurs trying to start the new process, system[launch] may not report any messages as to the cause of the error.
 The specified executable file is searched for in the same set of directories as commands entered on the system command line (as set by the PATH environment variable).
 system[launch] will return the process id of the spawned process.

 • The system command is thread-safe as of Maple 15.

Examples

 > $\mathrm{system}\left("echo test"\right)$

test 0

 > $\mathrm{system}[\mathrm{launch}]\left("notepad"\right)$
 > $\mathrm{system}[\mathrm{launch}]\left("xterm","-title","My Title"\right)$