fixes #4764, fixes #4731, fixes #4724

This commit is contained in:
Araq
2016-09-14 19:57:14 +02:00
parent da575bec54
commit 6a1b8e691f
5 changed files with 14 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext =
template cbos(name, body) {.dirty.} =
result.registerCallback "stdlib.system." & astToStr(name),
proc (a: VmArgs) =
errorMsg = nil
try:
body
except OSError:

View File

@@ -16,4 +16,8 @@ mkDir "bin/nimblepkg"
for file in listFiles("nimble" & $id & "/src/nimblepkg/"):
cpFile file, "bin/nimblepkg/" & file.extractFilename
mvFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe
try:
mvFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe
except OSError:
cpFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe

View File

@@ -580,9 +580,9 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
when useWinUnicode:
let s = newWideCString(source)
let d = newWideCString(dest)
if moveFileW(s, d, 0'i32) == 0'i32: raiseOSError(osLastError())
if moveFileW(s, d) == 0'i32: raiseOSError(osLastError())
else:
if moveFileA(source, dest, 0'i32) == 0'i32: raiseOSError(osLastError())
if moveFileA(source, dest) == 0'i32: raiseOSError(osLastError())
else:
if c_rename(source, dest) != 0'i32:
raiseOSError(osLastError(), $strerror(errno))

View File

@@ -116,6 +116,8 @@ template gcAssert(cond: bool, msg: string) =
echo "[GCASSERT] ", msg
GC_disable()
writeStackTrace()
#var x: ptr int
#echo x[]
quit 1
proc addZCT(s: var CellSeq, c: PCell) {.noinline.} =

View File

@@ -337,11 +337,10 @@ when useWinUnicode:
stdcall, dynlib: "kernel32", importc: "SetFileAttributesW".}
proc copyFileW*(lpExistingFileName, lpNewFileName: WideCString,
bFailIfExists: cint): cint {.
bFailIfExists: WINBOOL): WINBOOL {.
importc: "CopyFileW", stdcall, dynlib: "kernel32".}
proc moveFileW*(lpExistingFileName, lpNewFileName: WideCString,
bFailIfExists: cint): cint {.
proc moveFileW*(lpExistingFileName, lpNewFileName: WideCString): WINBOOL {.
importc: "MoveFileW", stdcall, dynlib: "kernel32".}
proc getEnvironmentStringsW*(): WideCString {.
@@ -368,8 +367,7 @@ else:
bFailIfExists: cint): cint {.
importc: "CopyFileA", stdcall, dynlib: "kernel32".}
proc moveFileA*(lpExistingFileName, lpNewFileName: cstring,
bFailIfExists: cint): cint {.
proc moveFileA*(lpExistingFileName, lpNewFileName: cstring): WINBOOL {.
importc: "MoveFileA", stdcall, dynlib: "kernel32".}
proc getEnvironmentStringsA*(): cstring {.
@@ -1035,4 +1033,4 @@ when defined(useWinAnsi):
else:
proc readConsoleInput*(hConsoleInput: Handle, lpBuffer: pointer, nLength: cint,
lpNumberOfEventsRead: ptr cint): cint
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}