[buck] don't clobber existing BUCK_EXTRA_JAVA_ARGS

Summary: The existing code overwrites the `BUCK_EXTRA_JAVA_ARGS` environment var.  It's better to extend it with our settings, if present.

Reviewed By: artempyanykh

Differential Revision: D26045398

fbshipit-source-id: 25588488c
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent 549954cb97
commit ad84126184

@ -11,6 +11,8 @@ module L = Logging
let max_command_line_length = 50 let max_command_line_length = 50
let buck_extra_java_args_env_var = "BUCK_EXTRA_JAVA_ARGS"
let store_args_in_file ~identifier args = let store_args_in_file ~identifier args =
let rec exceed_length ~max = function let rec exceed_length ~max = function
| _ when max < 0 -> | _ when max < 0 ->
@ -49,8 +51,12 @@ let wrap_buck_call ?(extend_env = []) ~label cmd =
Printf.sprintf "trap '' SIGQUIT ; exec %s >'%s'" escaped_cmd stdout_file Printf.sprintf "trap '' SIGQUIT ; exec %s >'%s'" escaped_cmd stdout_file
in in
let env = let env =
let existing_buck_extra_java_args = Sys.getenv buck_extra_java_args_env_var |> Option.to_list in
let new_buck_extra_java_args =
(* Instruct the JVM to avoid using signals. *) (* Instruct the JVM to avoid using signals. *)
`Extend (("BUCK_EXTRA_JAVA_ARGS", "-Xrs") :: extend_env) String.concat ~sep:" " (existing_buck_extra_java_args @ ["-Xrs"])
in
`Extend ((buck_extra_java_args_env_var, new_buck_extra_java_args) :: extend_env)
in in
let Unix.Process_info.{stdin; stdout; stderr; pid} = let Unix.Process_info.{stdin; stdout; stderr; pid} =
Unix.create_process_env ~prog:"sh" ~args:["-c"; sigquit_protected_cmd] ~env () Unix.create_process_env ~prog:"sh" ~args:["-c"; sigquit_protected_cmd] ~env ()

Loading…
Cancel
Save