fix: handle long/multiline prompts in _resolve_prompt
Skip the file-existence check when the prompt contains newlines (can't be a filename) and catch OSError for prompts that exceed the OS path length limit.
This commit is contained in:
parent
2aec223c5d
commit
d1bbd95c1c
1 changed files with 8 additions and 3 deletions
|
|
@ -57,9 +57,14 @@ class BuildResult:
|
||||||
|
|
||||||
def _resolve_prompt(prompt_value: str, project_dir: Path) -> str:
|
def _resolve_prompt(prompt_value: str, project_dir: Path) -> str:
|
||||||
"""Resolve a prompt: read from file if the path exists, otherwise use as-is."""
|
"""Resolve a prompt: read from file if the path exists, otherwise use as-is."""
|
||||||
candidate = project_dir / prompt_value
|
if "\n" in prompt_value:
|
||||||
if candidate.is_file():
|
return prompt_value
|
||||||
return candidate.read_text()
|
try:
|
||||||
|
candidate = project_dir / prompt_value
|
||||||
|
if candidate.is_file():
|
||||||
|
return candidate.read_text()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
return prompt_value
|
return prompt_value
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue