summaryrefslogtreecommitdiffstats
path: root/core/models
diff options
context:
space:
mode:
Diffstat (limited to 'core/models')
-rw-r--r--core/models/caves.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index 0a4cc3e..41a1b47 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -3,7 +3,8 @@ import os
import datetime
import re
import json
-from subprocess import call
+import subprocess
+
from collections import defaultdict
from pathlib import Path
@@ -56,8 +57,15 @@ def writetrogglefile(filepath, filecontent):
f.write(filecontent)
#os.chmod(filepath, 0o664) # set file permissions to rw-rw-r--
# should replace .call with .run and capture_output=True
- call([git, "add", filename], cwd=cwd)
- call([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd)
+ sp = subprocess.run([git, "add", filename], cwd=cwd, capture_output=True, check=True, text=True)
+ if sp.returncode != 0:
+ print(f'git ADD {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode))
+
+ sp = subprocess.run([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd, capture_output=True, check=True, text=True)
+ if sp.returncode != 0:
+ print(f'git COMMIT {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode))
+ # not catching and re-raising any exceptions yet, inc. the stderr etc.,. We should do that.
+
class Area(TroggleModel):