about summary refs log tree commit diff
path: root/third_party/nix/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix-build/nix-build.cc')
-rw-r--r--third_party/nix/src/nix-build/nix-build.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc
index 7ebb14e1f319..dde03c52cbe0 100644
--- a/third_party/nix/src/nix-build/nix-build.cc
+++ b/third_party/nix/src/nix-build/nix-build.cc
@@ -114,7 +114,8 @@ static void _main(int argc, char** argv) {
       !std::regex_search(argv[1], std::regex("nix-shell"))) {
     script = argv[1];
     try {
-      Strings lines = absl::StrSplit(readFile(script), absl::ByChar('\n'));
+      Strings lines = absl::StrSplit(readFile(script), absl::ByChar('\n'),
+                                     absl::SkipEmpty());
       if (std::regex_search(lines.front(), std::regex("^#!"))) {
         lines.pop_front();
         inShebang = true;
@@ -443,8 +444,9 @@ static void _main(int argc, char** argv) {
     env["NIX_STORE"] = store->storeDir;
     env["NIX_BUILD_CORES"] = std::to_string(settings.buildCores);
 
-    StringSet passAsFile = absl::StrSplit(get(drv.env, "passAsFile", ""),
-                                          absl::ByAnyChar(" \t\n\r"));
+    StringSet passAsFile =
+        absl::StrSplit(get(drv.env, "passAsFile", ""),
+                       absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
 
     bool keepTmp = false;
     int fileNr = 0;