Repository: pypa/pipenv

Issue:
pipenv fails when inside a directory starting with a dash
The real issue is filed [here](https://github.com/berdario/pew/issues/143), but would it make sense to add `-` to the list of characters to sanitize [here](https://github.com/kennethreitz/pipenv/blob/master/pipenv/project.py#L66)?

A test case:

```
$ git clone http://github.com/foo/bar.git -- "-deleteme"
Cloning into '-deleteme'...
remote: Counting objects: 1176, done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 1176 (delta 121), reused 131 (delta 104), pack-reused 1001
Receiving objects: 100% (1176/1176), 3.81 MiB | 1.42 MiB/s, done.
Resolving deltas: 100% (473/473), done.
$ cd -deleteme/
$ pipenv --three
Creating a virtualenv for this project...
⠋usage: pew [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d] [-a PROJECT]
           envname
pew: error: argument -d/--dont-activate: ignored explicit argument 'eleteme-srGrfIGO'

Virtualenv location: 
```


Discussion:
So I don't think there are any technical reasons we can't add `-` to that list, but that's a breaking change and is likely to irritate a lot of users since `-` is a pretty common character.

Before we start making decisions on how to address this though, I just want to make sure I understand the situation. From what I gathered in your issue on the `pew` repository, Jenkins is stripping path names to meet an 80 character max. Is that correct? Have you attempted to use this [suggested solution](https://issues.jenkins-ci.org/browse/JENKINS-38706?focusedCommentId=274531&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-274531) for Jenkins?
You are correct on what the issue is, and I did use that solution to successfully fix it for my situation. It's possible that `pipenv` would be used in a situation where it's not possible to use that solution, such as a hosted Jenkins instance, but that is probably too much of an edge case to consider making a breaking change in `pipenv` for, particularly since the real issue lies in `pew`.
closing as 'won't fix'

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -911,7 +911,6 @@ def do_create_virtualenv(python=None, site_packages=False):
             '-m',
             'pipenv.pew',
             'new',
-            project.virtualenv_name,
             '-d',
             '-a',
             project.project_directory,
@@ -929,6 +928,8 @@ def do_create_virtualenv(python=None, site_packages=False):
         err=True,
     )
     cmd = cmd + ['-p', python]
+    if not project.is_venv_in_project():
+        cmd = cmd + ['--', project.virtualenv_name]
     # Actually create the virtualenv.
     with spinner():
         try:


Test patch:
diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py
--- a/tests/integration/test_pipenv.py
+++ b/tests/integration/test_pipenv.py
@@ -2,11 +2,20 @@
 
 XXX: Try our best to reduce tests in this file.
 """
+import os
+from tempfile import gettempdir, mkdtemp
+
+import mock
+import pytest
 
 from pipenv.core import activate_virtualenv
 from pipenv.project import Project
 from pipenv.vendor import delegator
-import pytest
+
+try:
+    from pathlib import Path
+except ImportError:
+    from pipenv.vendor.pathlib2 import Path
 
 
 @pytest.mark.code
@@ -92,3 +101,26 @@ def test_proper_names_unamanged_virtualenv(PipenvInstance, pypi):
         assert c.return_code == 0
         project = Project()
         assert project.proper_names == []
+
+
+@pytest.mark.cli
+def test_directory_with_leading_dash(PipenvInstance):
+    def mocked_mkdtemp(suffix, prefix, dir):
+        if suffix == '-project':
+            temp_dir = Path(gettempdir()) / '-dir-with-leading-dash'
+            temp_dir.mkdir()
+            return str(temp_dir)
+        else:
+            return mkdtemp(suffix, prefix, dir)
+
+    with mock.patch('pipenv._compat.mkdtemp', side_effect=mocked_mkdtemp):
+        with PipenvInstance(chdir=True) as p:
+            # This environment variable is set in the context manager and will
+            # cause pipenv to use virtualenv, not pew.
+            del os.environ['PIPENV_VENV_IN_PROJECT']
+            p.pipenv('--python python')
+            venv_path = p.pipenv('--venv').out.strip()
+            assert os.path.isdir(venv_path)
+            # Manually clean up environment, since PipenvInstance assumes that
+            # the virutalenv is in the project directory.
+            p.pipenv('--rm')
\ No newline at end of file