[glib] mkenums: Don't raise when unlinking a file that does not exist
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] mkenums: Don't raise when unlinking a file that does not exist
- Date: Tue, 31 Oct 2017 15:23:31 +0000 (UTC)
commit 34148fc9b9edd8501ed2b0d483d0b8c942ac28ab
Author: Sam Spilsbury <sam endlessm com>
Date: Fri Oct 27 21:42:46 2017 +0800
mkenums: Don't raise when unlinking a file that does not exist
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=789637
gobject/glib-mkenums.in | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index 2d6a8c8..e8124b8 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -708,5 +708,11 @@ write_output("\n" + comment + "\n")
if tmpfile is not None:
tmpfilename = tmpfile.name
tmpfile.close()
- os.unlink(options.output)
+
+ try:
+ os.unlink(options.output)
+ except OSError as error:
+ if error.errno != errno.ENOENT:
+ raise error
+
os.rename(tmpfilename, options.output)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]