Skip to content

Commit

Permalink
Add compatibility WindowsError class
Browse files Browse the repository at this point in the history
- Fixes #18

Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Oct 16, 2018
1 parent 752d99e commit 18ec0fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vistir/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys

from collections import OrderedDict
from contextlib import contextmanager
from functools import partial

import six
Expand All @@ -17,6 +16,10 @@
from .compat import Path, fs_str, partialmethod
from .contextmanagers import spinner as spinner

if os.name != "nt":
class WindowsError(OSError):
pass


__all__ = [
"shell_escape",
Expand Down Expand Up @@ -103,7 +106,7 @@ def _spawn_subprocess(script, env={}, block=True, cwd=None, combine_stderr=True)
try:
return subprocess.Popen(cmd, **options)
except WindowsError as e:
if e.winerror != 193:
if getattr(e, "winerror", e.errno) != 193:
raise
options["shell"] = True
# Try shell mode to use Windows's file association for file launch.
Expand Down

0 comments on commit 18ec0fb

Please sign in to comment.