From 6b3aee6e353b335cd0c9487903b4f14451cb5628 Mon Sep 17 00:00:00 2001
From: Daniel Vedder <daniel.vedder@idiv.de>
Date: Tue, 10 Sep 2024 20:27:41 +0200
Subject: [PATCH] Yet another error removed :-/

---
 src/core/output.jl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/core/output.jl b/src/core/output.jl
index 2ff725c..abb18df 100644
--- a/src/core/output.jl
+++ b/src/core/output.jl
@@ -102,9 +102,12 @@ function saveinputfiles(model::SimulationModel)
         # Record the current git commit and versions of dependencies for reproducibility
         println(f, "# with Persefone $(pkgversion(Persefone)), git commit $(currentcommit),")
         println(f, "# running on Julia $(VERSION).\n#\n")
-        if !isempty(strip(read(`git status -s`, String)))
-            println(f, "# WARNING: Your repository contains uncommitted changes. This may")
-            println(f, "#          compromise the reproducibility of this simulation run.\n")
+        try # if this is loaded as a package, the directory may not be a git repo
+            if !isempty(strip(read(`git status -s`, String)))
+                println(f, "# WARNING: Your repository contains uncommitted changes. This may")
+                println(f, "#          compromise the reproducibility of this simulation run.\n")
+            end
+        catch
         end
         TOML.print(f, prepareTOML(deepcopy(model.settings)))
     end
-- 
GitLab