summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/imager/direct.py')
-rw-r--r--scripts/lib/wic/imager/direct.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index edf5e5d221..2bedef08d6 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -56,8 +56,9 @@ class DiskImage():
if self.created:
return
# create sparse disk image
- cmd = "truncate %s -s %s" % (self.device, self.size)
- exec_cmd(cmd)
+ with open(self.device, 'w') as sparse:
+ os.ftruncate(sparse.fileno(), self.size)
+
self.created = True
class DirectImageCreator(BaseImageCreator):