Skip to content
Snippets Groups Projects
Commit d99f8407 authored by Mohamad Barbar's avatar Mohamad Barbar Committed by Yorick Peterse
Browse files

"Short circuit" printing.

If printing the user argument fails, don't try to print a new line.
parent d78e22ce
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,8 +59,8 @@ impl Write for ThisModule {
## stderr.print # => Nil
def print(data: ?ToString = Nil) -> Integer {
process.blocking {
write_string(data.to_string) +
write_string(NEWLINE)
let written = try _INKOC.stderr_write(data.to_string) else return 0
written + _INKOC.stderr_write(NEWLINE)
}
}
 
Loading
Loading
Loading
Loading
@@ -60,8 +60,8 @@ impl Write for ThisModule {
## stdout.print # => Nil
def print(data: ?ToString = Nil) -> Integer {
process.blocking {
write_string(data.to_string) +
write_string(NEWLINE)
let written = try _INKOC.stdout_write(data.to_string) else return 0
written + _INKOC.stdout_write(NEWLINE)
}
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment