Merge pull request #1254 from efiop/master

system: catch link exceptions
This commit is contained in:
Ruslan Kuprieiev
2018-10-23 02:37:58 +03:00
committed by GitHub
+10 -3
View File
@@ -12,8 +12,11 @@ class System(object):
from dvc.exceptions import DvcException
if System.is_unix():
os.link(source, link_name)
return
try:
os.link(source, link_name)
return
except Exception as exc:
raise DvcException('link', cause=exc)
CreateHardLink = ctypes.windll.kernel32.CreateHardLinkW
CreateHardLink.argtypes = [ctypes.c_wchar_p,
@@ -31,7 +34,11 @@ class System(object):
from dvc.exceptions import DvcException
if System.is_unix():
return os.symlink(source, link_name)
try:
os.symlink(source, link_name)
return
except Exception as exc:
raise DvcException('symlink', cause=exc)
flags = 0
if source is not None and os.path.isdir(source):