Home > Objects > @Process > Process.m

iFit/Process

PURPOSE ^

pid=Process(command): spawn external processes

SYNOPSIS ^

function pid = Process(command)

DESCRIPTION ^

 pid=Process(command): spawn external processes

 The Process class allows to launch an external command in background,
 inquire its output and state during execution, and terminate it.

 The command to launch can be given as a single string, or as a cellstr.
 When used with a single string for both the program and its arguments,
 note that the string is parsed using white space as the delimiter.
 This cellstr calling syntax allows to pass arguments containing space
 delimiters.

   start an external command asynchronously (in background)
     pid = Process(command)

   determine if process is still running (active) and update
   stdout/stderr 
     refresh(pid); status = pid.isActive;
   or
     status = isreal(pid);

   wait for the end of the process (synchronous mode)
     waitfor(pid)
   or
     while any(isreal(pid)); pause(1); display(pid); end

   force process to end (kill)
     exit(pid)

 input:
   command: the external command line to launch, specified as a single 
            string with any additional arguments, or as a cellstr
            which first item is the commands, and subsequent items
            are command parameters.
            The command can also be given as an other Process object, which 
            command is then re-used (to restart a similar process).
 output:
   pid:     a Process object.

 examples:
   pid=Process('ping 127.0.0.1')
   pid=Process({'ping','127.0.0.1'})

 See also: Process/refresh, Process/exit
 Process is part of iFit http://ifit.mccode.org
 (c) E.Farhi, ILL. License: EUPL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 22-Mar-2017 09:13:30 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1