Support equals sign in shorthand environment variable values (#3869)

Some environment variables, such as `RUST_LOG` include equals signs. Nushell
should support this in the shorthand environment variable syntax so that
developers using these variables can control them easily. We accomplish this by
swapping `std::str::split` for `std::str::splitn`, which ensures that we only
consider the first equals sign in the string instead of all of them, which we
did previously.

Closes #3867
This commit is contained in:
Lily Mara
2021-07-30 14:10:28 -07:00
committed by GitHub
parent c3de9848b4
commit 762e528ec5
2 changed files with 47 additions and 1 deletions

View File

@ -1997,7 +1997,7 @@ fn expand_shorthand_forms(
if lite_pipeline.commands[0].parts[0].contains('=')
&& !lite_pipeline.commands[0].parts[0].starts_with('$')
{
let assignment: Vec<_> = lite_pipeline.commands[0].parts[0].split('=').collect();
let assignment: Vec<_> = lite_pipeline.commands[0].parts[0].splitn(2, '=').collect();
if assignment.len() != 2 {
(
lite_pipeline.clone(),