Skip to content

Commit

Permalink
# This is a combination of 4 commits.tree 332972403051e142cc1d0bd6729…
Browse files Browse the repository at this point in the history
…e6fbf466caadd

parent 5f4f0b8
author Las <haho013039@gmail.com> 1573141767 +0900
committer Las-Wonho <haho013039@gmail.com> 1573143303 +0900

# This is a combination of 3 commits.
# This is the 1st commit message:

Update run.py
# This is the commit message python-poetry#2:

Update run.py
# This is the commit message python-poetry#3:

Update run.py
# This is the commit message python-poetry#4:

Update run.py
  • Loading branch information
MagicalLas committed Nov 7, 2019
1 parent 5f4f0b8 commit 8845600
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions poetry/console/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ def run_script(self, script, args):

module, callable_ = script.split(":")

src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src() else ""
fixed_args = list(map(self.__fix_args_quotation_mark, args))
src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src(
) else ""
fixed_args = self.__fix_args_quotation_mark(args)

cmd = ["python", "-c"]

cmd += [
"import sys; "
"from importlib import import_module; "
"sys.argv = {!r}; {}"
"import_module('{}').{}()".format(fixed_args, src_in_sys_path, module, callable_)
]

return self.env.execute(*cmd)

@property
Expand Down Expand Up @@ -77,4 +76,4 @@ def merge_application_definition(self, merge_args=True):
self._application_definition_merged_with_args = True

def __fix_args_quotation_mark(self, args):
return str(args).replace('"', '\\""')
return str(args).replace('"', '\\"').replace("'", "\'")

0 comments on commit 8845600

Please sign in to comment.