Appends CodSpeed-required Node.js options to `NODE_OPTIONS` on a [`Command`], preserving any existing value from the environment.
(cmd: &mut Command)
| 5 | /// Appends CodSpeed-required Node.js options to `NODE_OPTIONS` on a [`Command`], |
| 6 | /// preserving any existing value from the environment. |
| 7 | pub fn set_node_options(cmd: &mut Command) { |
| 8 | let existing = std::env::var("NODE_OPTIONS").unwrap_or_default(); |
| 9 | let mut parts: Vec<&str> = existing.split_whitespace().collect(); |
| 10 | |
| 11 | for opt in NODE_OPTIONS_TO_ADD { |
| 12 | if !parts.contains(opt) { |
| 13 | parts.push(opt); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | cmd.env("NODE_OPTIONS", parts.join(" ")); |
| 18 | } |
no test coverage detected