Class List Method List File List

# Class: VertxShell::Process

Inherits:
  Object
  - Object
  - VertxShell::Process
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb

## Overview

A process managed by the shell.

## Instance Method Summary (collapse)

- - (Fixnum) exit_code
  @return the process exit code when the status is otherwise null.
- - (::VertxShell::Session) get_session
  @return the process session.
- - (::VertxShell::Tty) get_tty
  @return the process tty.
- - (true, false) interrupt? { ... }
  Attempt to interrupt the process.
- - (void) resume(foreground = nil) { ... }
  Suspend the process.
- - (void) run(foregraound = nil) { ... }
  Run the process.
- - (self) set_session(session = nil)
  Set the process session.
- - (self) set_tty(tty = nil)
  Set the process tty.
- - (:READY, ...) status
  @return the current process status.
- - (void) suspend { ... }
  Resume the process.
- - (void) terminate { ... }
  Terminate the process.
- - (self) terminated_handler { ... }
  Set an handler for being notified when the process terminates.
- - (void) to_background { ... }
  Set the process in background.
- - (void) to_foreground { ... }
  Set the process in foreground.

## Instance Method Details

### - (`Fixnum`) exit_code

@return the process exit code when the status is otherwise `null`

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

    28
    29
    30
    31
    32
    33
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 28

    def exit_code
      if !block_given?
        return @j_del.java_method(:exitCode, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling exit_code()"
    end

### - (`::VertxShell::Session`) get_session

@return the process session

Returns:

- (`::VertxShell::Session`)

Raises:

- (`ArgumentError`)

    67
    68
    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 67

    def get_session
      if !block_given?
        if @cached_get_session != nil
          return @cached_get_session
        end
        return @cached_get_session = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getSession, []).call(),::VertxShell::Session)
      end
      raise ArgumentError, "Invalid arguments when calling get_session()"
    end

### - (`::VertxShell::Tty`) get_tty

@return the process tty

Returns:

- (`::VertxShell::Tty`)

Raises:

- (`ArgumentError`)

    46
    47
    48
    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 46

    def get_tty
      if !block_given?
        if @cached_get_tty != nil
          return @cached_get_tty
        end
        return @cached_get_tty = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getTty, []).call(),::VertxShell::Tty)
      end
      raise ArgumentError, "Invalid arguments when calling get_tty()"
    end

### - (`true`, `false`) interrupt? { ... }

Attempt to interrupt the process.

Yields:

- handler called after interrupt callback

Returns:

- (`true`, `false`) —
  true if the process caught the signal

Raises:

- (`ArgumentError`)

    105
    106
    107
    108
    109
    110
    111
    112
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 105

    def interrupt?
      if !block_given?
        return @j_del.java_method(:interrupt, []).call()
      elsif block_given?
        return @j_del.java_method(:interrupt, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling interrupt?()"
    end

### - (`void`) resume(foreground = nil) { ... }

This method returns an undefined value.

Suspend the process.

Parameters:

- foreground (`true`, `false`) (defaults to: `nil`)

Yields:

- handler called after resume callback

Raises:

- (`ArgumentError`)

    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 117

    def resume(foreground=nil)
      if !block_given? && foreground == nil
        return @j_del.java_method(:resume, []).call()
      elsif (foreground.class == TrueClass || foreground.class == FalseClass) && !block_given?
        return @j_del.java_method(:resume, [Java::boolean.java_class]).call(foreground)
      elsif block_given? && foreground == nil
        return @j_del.java_method(:resume, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      elsif (foreground.class == TrueClass || foreground.class == FalseClass) && block_given?
        return @j_del.java_method(:resume, [Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(foreground,Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling resume(foreground)"
    end

### - (`void`) run(foregraound = nil) { ... }

This method returns an undefined value.

Run the process.

Parameters:

- foregraound (`true`, `false`) (defaults to: `nil`)

Yields:

- handler called after process callback

Raises:

- (`ArgumentError`)

    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 90

    def run(foregraound=nil)
      if !block_given? && foregraound == nil
        return @j_del.java_method(:run, []).call()
      elsif (foregraound.class == TrueClass || foregraound.class == FalseClass) && !block_given?
        return @j_del.java_method(:run, [Java::boolean.java_class]).call(foregraound)
      elsif block_given? && foregraound == nil
        return @j_del.java_method(:run, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      elsif (foregraound.class == TrueClass || foregraound.class == FalseClass) && block_given?
        return @j_del.java_method(:run, [Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(foregraound,Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling run(foregraound)"
    end

### - (`self`) set_session(session = nil)

Set the process session

Parameters:

- session (`::VertxShell::Session`) (defaults to: `nil`) —
  the process session

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 58

    def set_session(session=nil)
      if session.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:setSession, [Java::IoVertxExtShellSession::Session.java_class]).call(session.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_session(session)"
    end

### - (`self`) set_tty(tty = nil)

Set the process tty.

Parameters:

- tty (`::VertxShell::Tty`) (defaults to: `nil`) —
  the process tty

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    37
    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 37

    def set_tty(tty=nil)
      if tty.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:setTty, [Java::IoVertxExtShellTerm::Tty.java_class]).call(tty.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_tty(tty)"
    end

### - (`:READY`, ...) status

@return the current process status

Returns:

- (`:READY`, `:RUNNING`, `:STOPPED`, `:TERMINATED`)

Raises:

- (`ArgumentError`)

    20
    21
    22
    23
    24
    25
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 20

    def status
      if !block_given?
        return @j_del.java_method(:status, []).call().name.intern
      end
      raise ArgumentError, "Invalid arguments when calling status()"
    end

### - (`void`) suspend { ... }

This method returns an undefined value.

Resume the process.

Yields:

- handler called after suspend callback

Raises:

- (`ArgumentError`)

    132
    133
    134
    135
    136
    137
    138
    139
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 132

    def suspend
      if !block_given?
        return @j_del.java_method(:suspend, []).call()
      elsif block_given?
        return @j_del.java_method(:suspend, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling suspend()"
    end

### - (`void`) terminate { ... }

This method returns an undefined value.

Terminate the process.

Yields:

- handler called after end callback

Raises:

- (`ArgumentError`)

    143
    144
    145
    146
    147
    148
    149
    150
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 143

    def terminate
      if !block_given?
        return @j_del.java_method(:terminate, []).call()
      elsif block_given?
        return @j_del.java_method(:terminate, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling terminate()"
    end

### - (`self`) terminated_handler { ... }

Set an handler for being notified when the process terminates.

Yields:

- the handler called when the process terminates.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 79

    def terminated_handler
      if block_given?
        @j_del.java_method(:terminatedHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling terminated_handler()"
    end

### - (`void`) to_background { ... }

This method returns an undefined value.

Set the process in background.

Yields:

- handler called after background callback

Raises:

- (`ArgumentError`)

    154
    155
    156
    157
    158
    159
    160
    161
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 154

    def to_background
      if !block_given?
        return @j_del.java_method(:toBackground, []).call()
      elsif block_given?
        return @j_del.java_method(:toBackground, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling to_background()"
    end

### - (`void`) to_foreground { ... }

This method returns an undefined value.

Set the process in foreground.

Yields:

- handler called after foreground callback

Raises:

- (`ArgumentError`)

    165
    166
    167
    168
    169
    170
    171
    172
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/process.rb', line 165

    def to_foreground
      if !block_given?
        return @j_del.java_method(:toForeground, []).call()
      elsif block_given?
        return @j_del.java_method(:toForeground, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling to_foreground()"
    end