more enhancements for #11618 (#11976)

* finish the Windows IO layer changes; refs #11618
* added system.getOsFileHandle which is less error-prone on Windows
* make tests green again
This commit is contained in:
Andreas Rumpf 2019-08-18 22:57:56 +02:00 • committed by GitHub
commit 742862b847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 8 deletions

View file

@ -4496,12 +4496,6 @@ proc substr*(s: string, first = 0): string =
when defined(nimconfig):
include "system/nimscript"
when defined(windows) and appType == "console" and
not defined(nimDontSetUtf8CodePage) and not defined(nimscript):
proc setConsoleOutputCP(codepage: cint): cint {.stdcall, dynlib: "kernel32",
importc: "SetConsoleOutputCP".}
discard setConsoleOutputCP(65001) # 65001 - utf-8 codepage
when not defined(js):
proc toOpenArray*[T](x: ptr UncheckedArray[T]; first, last: int): openArray[T] {.
magic: "Slice".}