Avoid console windows when setting sparse flag on Windows

This commit is contained in:
shortcutme 2017-10-04 17:25:14 +02:00
parent 4c6e01d38d
commit b41570b663
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -340,7 +340,9 @@ class SiteStoragePlugin(object):
f.truncate(size)
f.close()
if os.name == "nt":
subprocess.call(["fsutil", "sparse", "setflag", file_path])
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
subprocess.call(["fsutil", "sparse", "setflag", file_path], close_fds=True, startupinfo=startupinfo)
if sha512 and sha512 in self.piecefields:
self.log.debug("%s: File not exists, but has piecefield. Deleting piecefield." % inner_path)