Skip to content

Commit ca67125

Browse files
Fix FileNotFoundError in CLI when CWD is deleted using PWD env fallback
1 parent 9605ab5 commit ca67125

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pythoncms/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def cli():
4141
@click.option("--run", is_flag=True, help="Initialize and run the server immediately")
4242
def start(name, run):
4343
"""Create a new pythoncms project"""
44-
dest = os.path.abspath(name)
44+
# Use PWD environment variable if available to handle deleted CWD
45+
base_dir = os.environ.get("PWD") or os.getcwd()
46+
dest = os.path.join(base_dir, name)
4547

4648
if os.path.exists(dest):
4749
click.echo(f"Error: Directory {name} already exists.")

0 commit comments

Comments
 (0)