summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-03-21 06:52:30 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-21 06:52:30 +0100
commit514674cb38e46b93d26f78e87244e1cfef67ccdb (patch)
treee5bd7164c3efce7f0a8d6086b5fe0188e8fe55ad
parent28a926cb679100414a71bb8aefe349c5bdf69b26 (diff)
downloadNim-514674cb38e46b93d26f78e87244e1cfef67ccdb.tar.gz
use abort instead of quit (#10872)
-rw-r--r--lib/system/embedded.nim3
-rw-r--r--lib/system/excpt.nim11
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/system/embedded.nim b/lib/system/embedded.nim
index fb89e7f0f..d1e05dad5 100644
--- a/lib/system/embedded.nim
+++ b/lib/system/embedded.nim
@@ -29,8 +29,7 @@ const
   nativeStackTraceSupported = false
   hasSomeStackTrace = false
 
-proc quitOrDebug() {.inline.} =
-  quit(1)
+proc quitOrDebug() {.noreturn, importc: "abort", header: "<stdlib.h>", nodecl.}
 
 proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} =
   sysFatal(ReraiseError, "exception handling is not available")
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 8849caee5..75a0e8967 100644
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -38,10 +38,15 @@ proc showErrorMessage(data: cstring) {.gcsafe.} =
       writeToStdErr(data)
 
 proc quitOrDebug() {.inline.} =
-  when not defined(endb):
-    quit(1)
-  else:
+  when defined(endb):
     endbStep() # call the debugger
+  elif not defined(nodejs) and not defined(nimscript):
+    when nimvm:
+      quit(1)
+    else:
+      c_abort()
+  else:
+    quit(1)
 
 proc chckIndx(i, a, b: int): int {.inline, compilerproc, benign.}
 proc chckRange(i, a, b: int): int {.inline, compilerproc, benign.}
ef='#n179'>179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380