From: Tatsuki SUGIURA Date: Mon, 21 Oct 2019 03:15:24 +0000 (+0900) Subject: Continue event if rsync errors. X-Git-Url: http://git.osdn.net/view?p=osdn-codes%2Fimage-creator.git;a=commitdiff_plain;h=57e87cb0fbbf96dc780bf15b4dc84573dbe1e45e Continue event if rsync errors. --- diff --git a/create-image b/create-image index 97ca990..7402631 100755 --- a/create-image +++ b/create-image @@ -100,7 +100,9 @@ class ImageCreator begin system("mount", dev, mount_point) or raise "Failed to mount file system #{dev} on #{mount_point}" puts "Copying #{src_host}:#{di.srcpath} to #{dev}..." - system("rsync", "-azHSAX", "--numeric-ids", "--info=progress2", "#{src_host}:#{di.srcpath}/", "#{mount_point}/", *((["--exclude"] * di.exclude.size).zip(di.exclude).flatten)) or raise "rsync fails" + unless system("rsync", "-azHSAX", "--numeric-ids", "--info=progress2", "#{src_host}:#{di.srcpath}/", "#{mount_point}/", *((["--exclude"] * di.exclude.size).zip(di.exclude).flatten)) + warn "rsync exit with error, file transfer may not be completed." + end ensure system("umount", mount_point) File.directory?(mount_point) and