ansi_c: support rawWrite(cstderr|cstdout, s) in js, nodejs, vm #16125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
followup on #16016.
with this PR:
rawWrite(cstderr|cstdout, s)
now works in js, nodejs, vm (and vm+js, vm+nodejs)this is useful in itself (in particular writing without newline for vm, unlike echo, or writing to stderr in vm/nodejs/js), and also avoids having to special case a lot of existing code using
rawWrite
for those backends.writeStackTrace writes to stderr for js,nodejs, consistently with docs for writeStackTrace and with c backend
--panics:on
now works better withjs/nodejs
(previously, would givestderr
not defined)example
nim r --panics main:
nim r -b:js --panics -d:nodejs main
almost same:
nim r -b:js --panics main
in this case it now correctly shows the AssertionDefect error + msg, but later fails for a different reason, because exit isn't defined; this can be fixed and is the same issue as #16074
Another caveat is rawWrite behaves more like some hypothetical
rawWriteln