You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[minor] Native IO.die adds extra blank lines to stderr for empty Halt messages #1101
Bend 2.0.29, native backend (the default bend <file.bend> execution).
Minimal reproducer
import Base
def main() -> IO(Unit):
do IO<Unit>:
IO.print_err("Usage\n")
IO.die(Unit, 2, "")
Command
bend repro.bend >stdout.txt 2>stderr.txt
printf "exit=%s\n" "$?"
od -An -tx1c stderr.txt
Observed
Exit code 2. The stderr bytes are Usage\n\n\n (three line feeds): the explicit error line followed by two additional newlines despite the empty IO.die message.
Expected
Exit code 2 and exactly Usage\n on stderr, so callers can print one user-facing error and use IO.die(..., "") without duplicate blank lines.
changed the title [-]Native IO.die adds extra blank lines to stderr for empty Halt messages[/-][+][minor] Native IO.die adds extra blank lines to stderr for empty Halt messages[/+]on Sep 26, 2026
Sorry, an agent went rogue and created the ticket directly here instead of my own repo for me to test. Feel free to close if not relevant or working as intended 🙏
This works as intended. IO.print_err adds a newline, as IO.print does, so IO.print_err("Usage\n") writes two. IO.die(_, 2, "") then writes its message and one more newline. The interpreter, C and JS all write Usage\n\n\n and exit 2. To get one line, write IO.print_err("Usage"). Closing, as you suggested.
Note: an AI wrote this reply after I made the decision. If anything here is wrong, reply and I will review it myself.
Activity
[-]Native IO.die adds extra blank lines to stderr for empty Halt messages[/-][+][minor] Native IO.die adds extra blank lines to stderr for empty Halt messages[/+]aballano commentedon Sep 26, 2026
Sorry, an agent went rogue and created the ticket directly here instead of my own repo for me to test. Feel free to close if not relevant or working as intended 🙏
VictorTaelin commentedon Sep 27, 2026
This works as intended.
IO.print_erradds a newline, asIO.printdoes, soIO.print_err("Usage\n")writes two.IO.die(_, 2, "")then writes its message and one more newline. The interpreter, C and JS all writeUsage\n\n\nand exit 2. To get one line, writeIO.print_err("Usage"). Closing, as you suggested.Note: an AI wrote this reply after I made the decision. If anything here is wrong, reply and I will review it myself.