mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
@@ -17,13 +17,6 @@
|
||||
const
|
||||
NilLibHandle: LibHandle = nil
|
||||
|
||||
proc c_fwrite(buf: pointer, size, n: csize, f: File): cint {.
|
||||
importc: "fwrite", header: "<stdio.h>".}
|
||||
|
||||
proc rawWrite(f: File, s: string|cstring) =
|
||||
# we cannot throw an exception here!
|
||||
discard c_fwrite(cstring(s), 1, s.len, f)
|
||||
|
||||
proc nimLoadLibraryError(path: string) =
|
||||
# carefully written to avoid memory allocation:
|
||||
stderr.rawWrite("could not load: ")
|
||||
|
||||
@@ -17,8 +17,15 @@ var
|
||||
## instead of stdmsg.write when printing stacktrace.
|
||||
## Unstable API.
|
||||
|
||||
proc c_fwrite(buf: pointer, size, n: csize, f: File): cint {.
|
||||
importc: "fwrite", header: "<stdio.h>".}
|
||||
|
||||
proc rawWrite(f: File, s: string|cstring) =
|
||||
# we cannot throw an exception here!
|
||||
discard c_fwrite(cstring(s), 1, s.len, f)
|
||||
|
||||
when not defined(windows) or not defined(guiapp):
|
||||
proc writeToStdErr(msg: cstring) = write(stdmsg, msg)
|
||||
proc writeToStdErr(msg: cstring) = rawWrite(stdmsg, msg)
|
||||
|
||||
else:
|
||||
proc MessageBoxA(hWnd: cint, lpText, lpCaption: cstring, uType: int): int32 {.
|
||||
|
||||
6
tests/exception/t9657.nim
Normal file
6
tests/exception/t9657.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
discard """
|
||||
action: run
|
||||
exitcode: 1
|
||||
"""
|
||||
close stdmsg
|
||||
writeLine stdmsg, "exception!"
|
||||
Reference in New Issue
Block a user