Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,13 +37,14 @@ except Exception:
|
|
| 37 |
# ---------------------------------------------------------------------------
|
| 38 |
|
| 39 |
def run_capture(cmd):
|
| 40 |
-
"""Run a command and return stdout
|
| 41 |
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 42 |
if result.returncode != 0:
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
raise RuntimeError("Command failed: " + " ".join(cmd) + "
|
| 45 |
-
" +
|
| 46 |
-
{err_tail}")
|
| 47 |
return result.stdout
|
| 48 |
|
| 49 |
|
|
|
|
| 37 |
# ---------------------------------------------------------------------------
|
| 38 |
|
| 39 |
def run_capture(cmd):
|
| 40 |
+
"""Run a command and return stdout; raise RuntimeError with readable stderr on failure."""
|
| 41 |
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 42 |
if result.returncode != 0:
|
| 43 |
+
stderr_text = result.stderr or ""
|
| 44 |
+
# Keep only tail to avoid massive logs
|
| 45 |
+
tail = stderr_text[-2000:]
|
| 46 |
raise RuntimeError("Command failed: " + " ".join(cmd) + "
|
| 47 |
+
" + tail)
|
|
|
|
| 48 |
return result.stdout
|
| 49 |
|
| 50 |
|