Module: Landlock::Runner

Defined in:
lib/landlock/runner.rb,
lib/landlock/runner/fork.rb,
lib/landlock/runner/native.rb

Defined Under Namespace

Modules: Fork, Native

Class Method Summary collapse

Class Method Details

.argv_for_exec(argv) ⇒ Object



7
8
9
10
# File 'lib/landlock/runner.rb', line 7

def argv_for_exec(argv)
  command = argv.fetch(0)
  [[command, command], *argv.drop(1)]
end

.exit_child!(error) ⇒ Object



19
20
21
22
23
# File 'lib/landlock/runner.rb', line 19

def exit_child!(error)
  warn "Landlock child failed before exec: #{error.class}: #{error.message}"
ensure
  exit! 127
end

.kernel_exec_args(argv, env, unsetenv_others:, close_others:) ⇒ Object



12
13
14
15
16
17
# File 'lib/landlock/runner.rb', line 12

def kernel_exec_args(argv, env, unsetenv_others:, close_others:)
  exec_options = { close_others: }
  exec_options[:unsetenv_others] = true if unsetenv_others

  env ? [env, *argv_for_exec(argv), exec_options] : [*argv_for_exec(argv), exec_options]
end