diff options
Diffstat (limited to 'third_party/nix/src/nix')
-rw-r--r-- | third_party/nix/src/nix/doctor.cc | 6 | ||||
-rw-r--r-- | third_party/nix/src/nix/edit.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/nix/run.cc | 6 | ||||
-rw-r--r-- | third_party/nix/src/nix/upgrade-nix.cc | 3 |
4 files changed, 12 insertions, 6 deletions
diff --git a/third_party/nix/src/nix/doctor.cc b/third_party/nix/src/nix/doctor.cc index 97c31d0376f1..0105b05e97fc 100644 --- a/third_party/nix/src/nix/doctor.cc +++ b/third_party/nix/src/nix/doctor.cc @@ -48,7 +48,8 @@ struct CmdDoctor final : StoreCommand { static bool checkNixInPath() { PathSet dirs; - for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) { + for (auto& dir : + absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) { if (pathExists(absl::StrCat(dir, "/nix-env"))) { dirs.insert(dirOf(canonPath(absl::StrCat(dir, "/nix-env"), true))); } @@ -71,7 +72,8 @@ struct CmdDoctor final : StoreCommand { static bool checkProfileRoots(const ref<Store>& store) { PathSet dirs; - for (auto dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) { + for (auto dir : + absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) { Path profileDir = dirOf(dir); try { Path userEnv = canonPath(profileDir, true); diff --git a/third_party/nix/src/nix/edit.cc b/third_party/nix/src/nix/edit.cc index 958e8aec49cc..a18cba292e00 100644 --- a/third_party/nix/src/nix/edit.cc +++ b/third_party/nix/src/nix/edit.cc @@ -55,7 +55,8 @@ struct CmdEdit final : InstallableCommand { auto editor = getEnv("EDITOR", "cat"); - Strings args = absl::StrSplit(editor, absl::ByAnyChar(" \t\n\r")); + Strings args = + absl::StrSplit(editor, absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty()); if (editor.find("emacs") != std::string::npos || editor.find("nano") != std::string::npos || diff --git a/third_party/nix/src/nix/run.cc b/third_party/nix/src/nix/run.cc index 241e0a2d7855..e76f8834cfc8 100644 --- a/third_party/nix/src/nix/run.cc +++ b/third_party/nix/src/nix/run.cc @@ -123,7 +123,8 @@ struct CmdRun final : InstallablesCommand { todo.push(path); } - Strings unixPath = absl::StrSplit(getEnv("PATH"), absl::ByChar(':')); + Strings unixPath = + absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty()); while (!todo.empty()) { Path path = todo.front(); @@ -137,7 +138,8 @@ struct CmdRun final : InstallablesCommand { auto propPath = path + "/nix-support/propagated-user-env-packages"; if (accessor->stat(propPath).type == FSAccessor::tRegular) { for (auto p : - absl::StrSplit(readFile(propPath), absl::ByAnyChar(" \t\n\r"))) { + absl::StrSplit(readFile(propPath), absl::ByAnyChar(" \t\n\r"), + absl::SkipEmpty())) { todo.push(std::string(p)); } } diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc index 3e3b55789df9..158e3cd1c2f8 100644 --- a/third_party/nix/src/nix/upgrade-nix.cc +++ b/third_party/nix/src/nix/upgrade-nix.cc @@ -103,7 +103,8 @@ struct CmdUpgradeNix final : MixDryRun, StoreCommand { static Path getProfileDir(const ref<Store>& store) { Path where; - for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) { + for (auto& dir : + absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) { if (pathExists(absl::StrCat(dir, "/nix-env"))) { where = dir; break; |