Darwin Help

Back to Index

TimedCallSystem

Function TimedCallSystem


Calling Sequence  TimedCallSystem(cmd)
TimedCallSystem(cmd,timeout)
Parameters
NameTypeDescription

cmd a string containing a system command 
timeout an optional integer number of seconds 
Return Type  [integer, string] (return code and result of command)
Synopsis The "cmd" argument is passed to the underlying operating system. If the optional "timeout" argument is specified, Darwin allows for "timeout" seconds of execution. If the command does not terminate in the allocated time, it is killed and the TimedCallSystem returns [-1, '(Timeout)'], otherwise it returns a list consisting of the execution return code value returned by the operating system and the output generated by cmd. The output is returned as a string. It will normally be ended with a newline character. Normally, a return code 0 indicates successful execution.
Examples
> TimedCallSystem(date,10);
[0, Fri Jun 18 17:10:23 CEST 2010
]
> TimedCallSystem('sleep 5',3);
[-1, (Timeout)]
See also CallSystem,   SystemCommand,   time,   UTCTime