Help us shape the future of Go! Take the 2026 Go Developer Survey

javaexec

package
v1.5.2-0...-36bfd17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package launcher tokenizes JAVA_OPTS and execs the JVM without invoking a shell. It exists to remove the runtime `eval "exec java $JAVA_OPTS ..."` start command, which lets the shell execute command substitutions and treat metacharacters (&, |, ;, newlines) in user-provided JAVA_OPTS as operators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs

func BuildArgs(java, javaOpts string, trusted []string) []string

BuildArgs assembles the full argv for execing the JVM. The resulting slice is [java, <tokenized JAVA_OPTS...>, <trusted args...>], mirroring the order of the previous `exec java $JAVA_OPTS <trusted>` start command. trusted args are produced by the buildpack (classpath, -jar/-cp, main class) and are passed through unchanged; only JAVA_OPTS is tokenized.

func TokenizeJavaOpts

func TokenizeJavaOpts(s string) []string

TokenizeJavaOpts splits a JAVA_OPTS string into individual arguments using POSIX shell word-splitting and quote-removal rules, but WITHOUT performing any expansion: variable references ($VAR), command substitutions ($(...) and backticks), globbing, and operators (&, |, ;, <, >) are all treated as ordinary literal text. This yields the same arguments the previous `eval`-based start command produced for normal and quoted inputs, while never executing embedded commands.

An empty or whitespace-only input yields no arguments (nil), so the JVM is never handed a spurious empty argument.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL