mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 12:17:09 +00:00
New debug page for subprocess runs
This commit is contained in:
@@ -318,12 +318,17 @@ def editexpopage(request, path):
|
||||
# see also core/models/cave.py writetrogglefile()
|
||||
f.write(result)
|
||||
# should replace .call with .run and capture_output=True
|
||||
subprocess.call([git, "add", filename], cwd=cwd)
|
||||
subprocess.call([git, "commit", "-m", 'Edit this page'], cwd=cwd)
|
||||
except PermissionError:
|
||||
message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {filename}. Ask a nerd to fix this.'
|
||||
return render(request,'errors/generic.html', {'message': message})
|
||||
except SubprocessError:
|
||||
|
||||
try:
|
||||
cp1 = subprocess.run([git, "add", filename], cwd=cwd, capture_output=True)
|
||||
cp2 = subprocess.run([git, "commit", "-m", 'Edit this page'], cwd=cwd, capture_output=True)
|
||||
message = f'Test output this file {filename}. git command output.\n' + str(cp1) + '\n\n' + str(cp2)
|
||||
return render(request,'errors/debug.html', {'message': message})
|
||||
|
||||
except subprocess.SubprocessError:
|
||||
message = f'CANNOT git on server for this file {filename}. Edits not saved.\nAsk a nerd to fix this.'
|
||||
return render(request,'errors/generic.html', {'message': message})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user