Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use SplitN when working with vars, unbreak vars with
=
in them
Previously, the functions that interacted with and handling the splitting of variables into names/values was using `strings.Split()`, which splits on each token and returns a slice with all of them. In the context we're operating here where it's `var=val`, we only ever need to split on the first `=`, so this switches to `strings.SplitN()` with a count of 2. This ensures that we only ever split on the first `=` present and that the second slice item is the entire remainder of the unsplit string. This ensures that variables with quotes in them can be properly parsed and not be skipped for being invalid. Ie, a var like this will now be properly parsed: `NODE_EXPORTER_FLAGS='--web.listen-address=":9100"'
- Loading branch information