From ed5e4c8fcc517e371181415b6edf59c1d92f4c9c Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Thu, 6 Aug 2015 14:14:44 +0200 Subject: [PATCH] Made osx-patch-ccid fail gracefully. Throwing an exception causes the installer to fail, which we don't want. --- resources/osx-patch-ccid | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/resources/osx-patch-ccid b/resources/osx-patch-ccid index e60b5c2f..4ccc00d1 100755 --- a/resources/osx-patch-ccid +++ b/resources/osx-patch-ccid @@ -52,19 +52,22 @@ def restart_pcscd(): def main(): print "Patching file:", FNAME - with open(FNAME, 'r') as f: - content = f.read() + try: + with open(FNAME, 'r') as f: + content = f.read() - for dev in DEVICES: - content = add_device(dev, content) + for dev in DEVICES: + content = add_device(dev, content) - print "Saving file:", FNAME - with open(FNAME, 'w') as f: - f.write(content) + print "Saving file:", FNAME + with open(FNAME, 'w') as f: + f.write(content) - restart_pcscd() + restart_pcscd() - print "Patching complete!" + print "Patching complete!" + except IOError as e: + print "Error patching file:", e if __name__ == '__main__':