1
0
Fork 0
mirror of synced 2024-12-21 21:51:08 -05:00

Display better error message when linking fails

When failing to symbolically linking files, display the names of the
files that could not be linked. This makes it easier to troubleshoot the
error without having to manually figure out which files failed to link.
This commit is contained in:
Anish Athalye 2014-07-17 10:02:53 -07:00
parent a97096ef96
commit 5394184d14

View file

@ -60,9 +60,13 @@ class Linker(Executor):
self._log.warning('Invalid link %s -> %s' %
(link_name, self._link_destination(link_name)))
elif not self._exists(link_name) and self._exists(source):
self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
os.symlink(source, os.path.expanduser(link_name))
success = True
try:
os.symlink(source, os.path.expanduser(link_name))
except OSError as e:
self._log.warning('Linking failed %s -> %s' % (link_name, source))
else:
self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
success = True
elif self._exists(link_name) and not self._is_link(link_name):
self._log.warning(
'%s already exists but is a regular file or directory' %