nephila / djangocms-installer

Console wizard to bootstrap django CMS projects
https://djangocms-installer.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
177 stars 78 forks source link

Cannot handle spaces in project path #310

Closed matthijskooijman closed 7 years ago

matthijskooijman commented 7 years ago

When the project path includes a space, the installer breaks:

matthijs@grubby:~/with space$ djangocms mysite
Creating the project
Please wait while I install dependencies
Dependencies installed
Creating the project
usage: django-admin.py startproject [-h] [--version] [-v {0,1,2,3}]
                                    [--settings SETTINGS]
                                    [--pythonpath PYTHONPATH] [--traceback]
                                    [--no-color] [--template TEMPLATE]
                                    [--extension EXTENSIONS] [--name FILES]
                                    name [directory]
django-admin.py startproject: error: unrecognized arguments: space/mysite
The installation has failed.

The problem comes from these lines: https://github.com/nephila/djangocms-installer/blob/develop/djangocms_installer/django/__init__.py#L56-L59

There, the command to run is joined into a single string, without proper escaping, and then passed to the shell to split again. There does not seem any point to this, since the argument is already nicely split and can be passed to subprocess as-is:

cmd_args = [sys.executable, start_cmd, 'startproject'] + args
if config_data.verbose:
    sys.stdout.write('Project creation command: {0}\n'.format(''.join(cmd_args)))
output = subprocess.check_output(cmd_args)
yakky commented 7 years ago

Thanks for reporting

yakky commented 7 years ago

Closed via #313