Skip to content

Commit f1ce670

Browse files
Handle deleted CWD gracefully in CLI
1 parent 48617dd commit f1ce670

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pythoncms/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ 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.join(os.getcwd(), name)
44+
try:
45+
current_dir = Path.cwd()
46+
except FileNotFoundError:
47+
click.echo("Error: The current working directory does not exist. Please change to a valid directory.")
48+
return
49+
50+
dest = os.path.join(str(current_dir), name)
4551

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

0 commit comments

Comments
 (0)