Module: Jvm

Defined in:
lib/tebako-runtime/adapters/mn2pdf.rb,
lib/tebako-runtime/adapters/mn2pdf.rb

Overview

The java resolution + the spawn shape (the memfs-binary exec path): when the openjdk toolkit payload is mounted, its /opt/openjdk/bin/java wins over PATH; the spawn is the ARRAY form — the shell form (Open3.capture3(string)) goes through /bin/sh, which the tebako spawn hook deliberately skips.

Constant Summary collapse

MN2PDF_JAR_PATH =
TebakoRuntime::MN2PDF_J_PATH

Class Method Summary collapse

Class Method Details

.run(args = []) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/tebako-runtime/adapters/mn2pdf.rb', line 68

def self.run(args = [])
  java = TebakoRuntime.mounted_exe("openjdk", "java")
  return run_orig(args) if java == "java"

  # The stock form joins everything into a SHELL string: values ride
  # shell-quoted (whole-value and inner forms), and legacy callers pass
  # whole fragments in one element (`--param baseassetpath="/dir"`).
  # The array spawn needs shell-word rules applied — split on unquoted
  # spaces, shed the quotes — exactly what the shell did with the
  # stock string.
  clean = args.flat_map { |a| TebakoRuntime.shell_split(a.to_s) }
  cmd = [java, *options, "-jar", MN2PDF_JAR_PATH.to_s, *clean]
  puts cmd.join(" ")
  Open3.capture3(*cmd).then { |stdout, stderr, status| [stdout, stderr, status] }
end