MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / rubyStyleEscape

Function rubyStyleEscape

src/java/frameworks/java_opts.go:185–196  ·  view source on GitHub ↗

rubyStyleEscape escapes a Java option exactly like the Ruby buildpack Ruby source: lib/java_buildpack/framework/java_opts.rb:40-41 .map { |java_opt| /(? .+?)=(? .+)/ =~ java_opt ? "#{key}=#{escape_value(value)}" : java_opt } Strategy: Split on first '=' and escape only the VALUE part

(javaOpt string)

Source from the content-addressed store, hash-verified

183// "-Dkey=value with spaces" → "-Dkey=value\\ with\\ spaces"
184// "-XX:OnOutOfMemoryError=kill -9 %p" → "-XX:OnOutOfMemoryError=kill\\ -9\\ \\%p"
185func rubyStyleEscape(javaOpt string) string {
186 idx := strings.IndexByte(javaOpt, '=')
187
188 if idx == -1 || idx == len(javaOpt)-1 {
189 return javaOpt // No '=' or ends with '='
190 }
191
192 key := javaOpt[:idx]
193 value := javaOpt[idx+1:]
194
195 return key + "=" + escapeValue(value)
196}
197
198// escapeValue escapes a string for shell safety using Ruby's escape_value method
199//

Callers 2

FinalizeMethod · 0.85
java_opts_test.goFile · 0.85

Calls 1

escapeValueFunction · 0.85

Tested by

no test coverage detected