Class: Yap::Shell::Execution::FileSystemCommandExecution

Inherits:
CommandExecution show all
Defined in:
lib/yap/shell/execution/file_system_command_execution.rb

Instance Attribute Summary

Attributes inherited from CommandExecution

#stderr, #stdin, #stdout, #world

Instance Method Summary collapse

Methods inherited from CommandExecution

#execute, #initialize, on_execute, #suspended?

Constructor Details

This class inherits a constructor from Yap::Shell::Execution::CommandExecution

Instance Method Details

#resumeObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/yap/shell/execution/file_system_command_execution.rb', line 112

def resume
  args = @suspended
  @suspended = nil
  pid = args[:pid]
  sigcont = Signal.list["CONT"]

  Treefell['shell'].puts "resuming suspended process pid=#{pid} by sending it signal=#{sigcont}"
  resume_blk = lambda do
    Process.kill sigcont, pid
    pid
  end

  self.instance_exec command:args[:command], n:args[:n], of:args[:of], resume_blk:resume_blk, wait:true, &self.class.on_execute
end

#suspended(command:, n:, of:, pid:) ⇒ Object



127
128
129
130
131
132
133
134
135
# File 'lib/yap/shell/execution/file_system_command_execution.rb', line 127

def suspended(command:, n:, of:, pid:)
  Treefell['shell'].puts "process pid=#{pid} suspended"
  @suspended = {
    command: command,
    n: n,
    of: of,
    pid: pid
  }
end