Class List Method List File List

# Class: VertxShell::Process

Inherits:
  Object
  - Object
  - VertxShell::Process
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb

## Overview

A process managed by the shell.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (Fixnum) exit_code
  The process exit code when the status is otherwise null.
- - (::VertxShell::Session) get_session
  The process session.
- - (::VertxShell::Tty) get_tty
  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
  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.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == Process
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    31
    32
    33
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 31

    def self.j_class
      Java::IoVertxExtShellSystem::Process.java_class
    end

### + (`Object`) unwrap(obj)

    25
    26
    27
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 25

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 22

    def @@j_api_type.wrap(obj)
      Process.new(obj)
    end

## Instance Method Details

### - (`Fixnum`) exit_code

Returns the process exit code when the status is otherwise `null`

Returns:

- (`Fixnum`) —
  the process exit code when the status is otherwise `null`

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 42

    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

Returns the process session

Returns:

- (`::VertxShell::Session`) —
  the process session

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    86
    87
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 79

    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

Returns the process tty

Returns:

- (`::VertxShell::Tty`) —
  the process tty

Raises:

- (`ArgumentError`)

    59
    60
    61
    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 59

    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`)

    113
    114
    115
    116
    117
    118
    119
    120
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 113

    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`)

    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 125

    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`)

Raises:

- (`ArgumentError`)

    102
    103
    104
    105
    106
    107
    108
    109
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 102

    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)
      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`)

    71
    72
    73
    74
    75
    76
    77
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 71

    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`)

    51
    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 51

    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

Returns the current process status

Returns:

- (`:READY`, `:RUNNING`, `:STOPPED`, `:TERMINATED`) —
  the current process status

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 35

    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`)

    140
    141
    142
    143
    144
    145
    146
    147
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 140

    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`)

    151
    152
    153
    154
    155
    156
    157
    158
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 151

    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`)

    91
    92
    93
    94
    95
    96
    97
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 91

    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`)

    162
    163
    164
    165
    166
    167
    168
    169
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 162

    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`)

    173
    174
    175
    176
    177
    178
    179
    180
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/process.rb', line 173

    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