From 093b8ce5cccd7aac3996bea5a293f0e0172fad95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 16 Dec 2023 11:44:02 +0100 Subject: [PATCH] apply treefmt --- src/nix-eval-jobs.cc | 28 +++++++++++++++------------- tests/test_eval.py | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 44b88e7..3c7280d 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -113,13 +113,14 @@ void handleBrokenWorkerPipe(Proc &proc, std::string_view msg) { int rc = waitpid(pid, &status, WNOHANG); if (rc == 0) { kill(pid, SIGKILL); - throw Error( - "BUG: while %s, worker pipe got closed but evaluation worker still running?", - msg); + throw Error("BUG: while %s, worker pipe got closed but evaluation " + "worker still running?", + msg); } else if (rc == -1) { kill(pid, SIGKILL); - throw Error("BUG: while %s, waitpid for evaluation worker failed: %s", - msg, strerror(errno)); + throw Error( + "BUG: while %s, waitpid for evaluation worker failed: %s", msg, + strerror(errno)); } else { if (WIFEXITED(status)) { if (WEXITSTATUS(status) == 1) { @@ -128,14 +129,14 @@ void handleBrokenWorkerPipe(Proc &proc, std::string_view msg) { "(possibly an infinite recursion)", msg); } - throw Error("while %s, evaluation worker exited with %d", - msg, WEXITSTATUS(status)); + throw Error("while %s, evaluation worker exited with %d", msg, + WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { if (WTERMSIG(status) == SIGKILL) { - throw Error( - "while %s, evaluation worker got killed by SIGKILL, maybe " - "memory limit reached?", - msg); + throw Error("while %s, evaluation worker got killed by " + "SIGKILL, maybe " + "memory limit reached?", + msg); } throw Error( "while %s, evaluation worker got killed by signal %d (%s)", @@ -147,7 +148,7 @@ void handleBrokenWorkerPipe(Proc &proc, std::string_view msg) { std::string joinAttrPath(json &attrPath) { std::string joined; - for (auto& element : attrPath) { + for (auto &element : attrPath) { if (!joined.empty()) { joined += '.'; } @@ -220,7 +221,8 @@ void collector(Sync &state_, std::condition_variable &wakeup) { /* Wait for the response. */ auto respString = fromReader->readLine(); if (respString.empty()) { - auto msg = "reading result for attrPath '" + joinAttrPath(attrPath) + "'"; + auto msg = "reading result for attrPath '" + + joinAttrPath(attrPath) + "'"; handleBrokenWorkerPipe(*proc.get(), msg); } json response; diff --git a/tests/test_eval.py b/tests/test_eval.py index 93a17ac..8fa41cb 100644 --- a/tests/test_eval.py +++ b/tests/test_eval.py @@ -116,5 +116,5 @@ def test_recursion_error() -> None: ) assert res.returncode == 1 print(res.stderr) - assert 'packageWithInfiniteRecursion' in res.stderr + assert "packageWithInfiniteRecursion" in res.stderr assert "possible infinite recursion" in res.stderr