diff options
| author | Roy Sommer <illBeRoy@users.noreply.github.com> | 2020-11-28 00:56:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-28 00:56:16 +0200 |
| commit | a77e37f2f02e22f341f2221036bcdac6647807f3 (patch) | |
| tree | 38e43c7840db18d3b96ec50db15b1af6108f3e34 /task | |
| parent | Release version 1.5.0 (diff) | |
| download | taskipy2-a77e37f2f02e22f341f2221036bcdac6647807f3.zip | |
Support Windows-Style Paths (#27)
use mslex instead of shlex when running on windows.
added a new windows sanity ci test.
Diffstat (limited to '')
| -rw-r--r-- | taskipy/task.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/taskipy/task.py b/taskipy/task.py index 231dacf..05e6329 100644 --- a/taskipy/task.py +++ b/taskipy/task.py @@ -1,4 +1,6 @@ +import platform import shlex +import mslex # type: ignore from typing import Optional, List from taskipy.exceptions import ( @@ -32,7 +34,7 @@ class Task: command = self.project.tasks[self.name] commands = [] commands.append( - ' '.join([command] + [shlex.quote(arg) for arg in self.args]) + ' '.join([command] + [self.__quote_arg(arg) for arg in self.args]) ) if self.pre_task: @@ -62,3 +64,8 @@ class Task: return self.project.tasks[f'{hook_type}_{self.name}'] except KeyError: return None + + def __quote_arg(self, arg: str) -> str: + if platform.system() == 'Windows': + return mslex.quote(arg) + return shlex.quote(arg) |