Skip to content

Commit 0631240

Browse files
committed
fix: skip usage
1 parent bf29d20 commit 0631240

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/isolate/backends/virtualenv.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import contextlib
44
import io
55
import os
6+
import re
67
import shutil
78
import subprocess
89
import sys
@@ -208,6 +209,10 @@ def create(self, *, force: bool = False) -> Path:
208209
virtualenv.cli_run(args)
209210
except (SystemExit, RuntimeError, OSError) as exc:
210211
stderr_output = stderr_capture.getvalue().strip()
212+
# Strip the verbose argparse usage banner
213+
stderr_output = re.sub(
214+
r"^usage:.*\n(?:\s.*\n)*", "", stderr_output
215+
).strip()
211216
ellipsed_stderr = (
212217
f"...{stderr_output[-_MAX_ERROR_MESSAGE_LENGTH:]}"
213218
if len(stderr_output) > _MAX_ERROR_MESSAGE_LENGTH

0 commit comments

Comments
 (0)