Class Spawner

java.lang.Object
java.lang.Process
org.eclipse.cdt.utils.spawner.Spawner

public class Spawner extends Process
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
    static class 
     
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Spawner(String command)
    Deprecated.
    Do not use this method it splits command line arguments on whitespace with no regard to quoting rules.
    protected
    Spawner(String[] cmdarray)
    Executes the specified command and arguments in a separate process.
    protected
    Spawner(String[] cmdarray, int gracefulExitTimeMs)
     
    protected
    Spawner(String[] cmdarray, String[] envp)
    Executes the specified command and arguments in a separate process with the specified environment.
    protected
    Spawner(String[] cmdarray, String[] envp, int gracefulExitTimeMs)
     
    protected
    Spawner(String[] cmdarray, String[] envp, File dir)
     
    protected
    Spawner(String[] cmdarray, String[] envp, File dir, int gracefulExitTimeMs)
    Executes the specified command and arguments in a separate process with the specified environment and working directory.
    protected
    Spawner(String[] cmdarray, String[] envp, File dir, PTY pty)
     
    protected
    Spawner(String[] cmdarray, String[] envp, File dir, PTY pty, int gracefulExitTimeMs)
     
     
    Spawner(String command, boolean bNoRedirect)
    Deprecated.
    Do not use this method it splits command line arguments on whitespace with no regard to quoting rules.
    protected
    Spawner(String cmd, String[] envp)
    Deprecated.
    Do not use this method it splits command line arguments on whitespace with no regard to quoting rules.
    protected
    Spawner(String command, String[] envp, File dir)
    Deprecated.
    Do not use this method it splits command line arguments on whitespace with no regard to quoting rules.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    See java.lang.Process#destroy (); Clients are responsible for explicitly closing any streams that they have requested through getErrorStream(), getInputStream() or getOutputStream()
    void
    exec_detached(String[] cmdarray, String[] envp, String dirpath)
     
    int
    exec2(String[] cmdarray, String[] envp, String dir, Spawner.IChannel[] chan, String slaveName, int masterFD, boolean console)
    Native method when executing with a terminal emulation.
    int
    See java.lang.Process#exitValue ();
    protected void
     
    See java.lang.Process#getErrorStream (); The client is responsible for closing the stream explicitly.
    See java.lang.Process#getInputStream (); The client is responsible for closing the stream explicitly.
    See java.lang.Process#getOutputStream (); The client is responsible for closing the stream explicitly.
    int
     
    int
    On Windows, interrupt the spawned program by using Cygwin's utility 'kill -SIGINT' if it's a Cgywin program, otherwise send it a CTRL-C.
    int
    On Windows, interrupt the spawned program by send it a CTRL-C (even if it's a Cygwin program).
    boolean
     
    int
     
    long
    pid()
     
    int
    raise(int sig)
     
    int
    raise(int processID, int sig)
    Native method to drop a signal on the process with pid.
    int
     
    int
    See java.lang.Process#waitFor ();
    int
    waitFor(int processID)
    Native method to wait(3) for process to terminate.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NOOP

      @Deprecated(forRemoval=true) public int NOOP
      Deprecated, for removal: This API element is subject to removal in a future version.
    • HUP

      @Deprecated(forRemoval=true) public int HUP
      Deprecated, for removal: This API element is subject to removal in a future version.
    • KILL

      @Deprecated(forRemoval=true) public int KILL
      Deprecated, for removal: This API element is subject to removal in a future version.
    • TERM

      @Deprecated(forRemoval=true) public int TERM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • INT

      @Deprecated(forRemoval=true) public int INT
      Deprecated, for removal: This API element is subject to removal in a future version.
    • CTRLC

      @Deprecated(forRemoval=true) public int CTRLC
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.2
  • Constructor Details

    • Spawner

      @Deprecated public Spawner(String command, boolean bNoRedirect) throws IOException
      Deprecated.
      Do not use this method it splits command line arguments on whitespace with no regard to quoting rules. See Bug 573677
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp, File dir) throws IOException
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp, File dir, int gracefulExitTimeMs) throws IOException
      Executes the specified command and arguments in a separate process with the specified environment and working directory.
      Throws:
      IOException
      Since:
      6.2
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp, File dir, PTY pty) throws IOException
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp, File dir, PTY pty, int gracefulExitTimeMs) throws IOException
      Throws:
      IOException
      Since:
      6.2
    • Spawner

      @Deprecated protected Spawner(String command) throws IOException
      Deprecated.
      Do not use this method it splits command line arguments on whitespace with no regard to quoting rules. See Bug 573677
      Executes the specified string command in a separate process.
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray) throws IOException
      Executes the specified command and arguments in a separate process.
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray, int gracefulExitTimeMs) throws IOException
      Throws:
      IOException
      Since:
      6.2
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp) throws IOException
      Executes the specified command and arguments in a separate process with the specified environment.
      Throws:
      IOException
    • Spawner

      protected Spawner(String[] cmdarray, String[] envp, int gracefulExitTimeMs) throws IOException
      Throws:
      IOException
      Since:
      6.2
    • Spawner

      @Deprecated protected Spawner(String cmd, String[] envp) throws IOException
      Deprecated.
      Do not use this method it splits command line arguments on whitespace with no regard to quoting rules. See Bug 573677
      Executes the specified string command in a separate process with the specified environment.
      Throws:
      IOException
    • Spawner

      @Deprecated protected Spawner(String command, String[] envp, File dir) throws IOException
      Deprecated.
      Do not use this method it splits command line arguments on whitespace with no regard to quoting rules. See Bug 573677
      Executes the specified string command in a separate process with the specified environment and working directory.
      Throws:
      IOException
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • getInputStream

      public InputStream getInputStream()
      See java.lang.Process#getInputStream (); The client is responsible for closing the stream explicitly.
      Specified by:
      getInputStream in class Process
    • getOutputStream

      public OutputStream getOutputStream()
      See java.lang.Process#getOutputStream (); The client is responsible for closing the stream explicitly.
      Specified by:
      getOutputStream in class Process
    • getErrorStream

      public InputStream getErrorStream()
      See java.lang.Process#getErrorStream (); The client is responsible for closing the stream explicitly.
      Specified by:
      getErrorStream in class Process
    • waitFor

      public int waitFor() throws InterruptedException
      See java.lang.Process#waitFor ();
      Specified by:
      waitFor in class Process
      Throws:
      InterruptedException
    • exitValue

      public int exitValue()
      See java.lang.Process#exitValue ();
      Specified by:
      exitValue in class Process
    • destroy

      public void destroy()
      See java.lang.Process#destroy (); Clients are responsible for explicitly closing any streams that they have requested through getErrorStream(), getInputStream() or getOutputStream()
      Specified by:
      destroy in class Process
    • pid

      public long pid()
      Overrides:
      pid in class Process
    • interrupt

      public int interrupt()
      On Windows, interrupt the spawned program by using Cygwin's utility 'kill -SIGINT' if it's a Cgywin program, otherwise send it a CTRL-C. If Cygwin's 'kill' command is not available, send a CTRL-C. On linux, interrupt it by raising a SIGINT.
    • interruptCTRLC

      public int interruptCTRLC()
      On Windows, interrupt the spawned program by send it a CTRL-C (even if it's a Cygwin program). On linux, interrupt it by raising a SIGINT.
      Since:
      5.2
    • hangup

      public int hangup()
    • kill

      public int kill()
    • terminate

      public int terminate()
    • isRunning

      public boolean isRunning()
    • exec_detached

      public void exec_detached(String[] cmdarray, String[] envp, String dirpath) throws IOException
      Throws:
      IOException
    • exec2

      public int exec2(String[] cmdarray, String[] envp, String dir, Spawner.IChannel[] chan, String slaveName, int masterFD, boolean console) throws IOException
      Native method when executing with a terminal emulation.
      Throws:
      IOException
      Restriction:
      This method is not intended to be referenced by clients.
    • raise

      public int raise(int processID, int sig)
      Native method to drop a signal on the process with pid.
    • raise

      public int raise(int sig)
      Since:
      6.2
    • waitFor

      public int waitFor(int processID)
      Native method to wait(3) for process to terminate.
      Restriction:
      This method is not intended to be referenced by clients.