Commit Graph

6 Commits (master)

Author SHA1 Message Date
Oliver Henshaw 15eba7b7e6
[Fix] `nvm_strip_path`: Preserve leading/trailing colons
Path lists in environmental variables often give special meaning to
empty entries (e.g. in PATH or MANPATH). These are represented by
leading or trailing colons, or by doubled colons in the middle of the
list.

Adjust the awk invocation to correctly deal with trailing colons by
printing the separator before every field except the first, and then
printing the final separator that is read from the input - this will
either be a colon or the null string. This preserves leading and
trailing colons in all cases while not adding extra colons in the wrong
place.

Add test to confirm the correct behaviour.

Fixes #3144
2023-06-21 15:47:52 +01:00
Kaito Udagawa 53f9ba8336
[Refactor] Use awk for path stripping
This works with paths which contains regex meta characters.
2016-12-23 01:03:41 +09:00
Peter Dave Hello f7763c8ba9
[Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
Qiangjun Ran cadbbced20
[Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Jordan Harband dbeeb683da Fix `nvm_strip_path` for >= v0.12.0 node, and all io.js versions. 2015-01-18 23:55:26 -08:00
Koen Punt e3b84499c2 use regex triplet, add unit test 2014-05-07 10:58:21 +02:00