summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/std/syncio.nim6
-rw-r--r--tests/misc/t19600.nim9
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/std/syncio.nim b/lib/std/syncio.nim
index 22e981198..4eeb1778d 100644
--- a/lib/std/syncio.nim
+++ b/lib/std/syncio.nim
@@ -324,7 +324,9 @@ const
 proc close*(f: File) {.tags: [], gcsafe.} =
   ## Closes the file.
   if not f.isNil:
-    discard c_fclose(f)
+    let x = c_fclose(f)
+    if x < 0:
+      checkErr(f)
 
 proc readChar*(f: File): char {.tags: [ReadIOEffect].} =
   ## Reads a single character from the stream `f`. Should not be used in
@@ -689,7 +691,7 @@ when defined(posix) and not defined(nimscript):
 
 proc open*(f: var File, filename: string,
           mode: FileMode = fmRead,
-          bufSize: int = -1): bool {.tags: [], raises: [], benign.} =
+          bufSize: int = -1): bool {.tags: [], raises: [IOError], benign.} =
   ## Opens a file named `filename` with given `mode`.
   ##
   ## Default mode is readonly. Returns true if the file could be opened.
diff --git a/tests/misc/t19600.nim b/tests/misc/t19600.nim
new file mode 100644
index 000000000..3708dac18
--- /dev/null
+++ b/tests/misc/t19600.nim
@@ -0,0 +1,9 @@
+discard """
+  targets: "c cpp"
+  disabled: "win"
+  disabled: "osx"
+  exitcode: 1
+  outputsub: "No space left on device"
+"""
+
+writeFile("/dev/full", "hello\n")