From d8213e29c5a4a2e628bd2e15400165bf3c3e1049 Mon Sep 17 00:00:00 2001 From: Emilie Burgun Date: Thu, 6 Feb 2025 22:55:40 +0100 Subject: [PATCH] Fix set_output/1 and set_input/1 not updating the alias Before this change, the following set of queries would behave incorrectly: ``` ?- open("/tmp/out.log", write, S), set_output(S). prints(""), write("/tmp/out.log", "S = stream(...)"). ?- write(user_output, hello). prints("hello"), unexpected. prints(""), write("/tmp/out.log", "hello"). % Expected, but not found. ``` Now, `set_output/1` and `set_input/1` properly bind the `user_output` and `user_input` aliases, making the queries above behave as expected. --- src/machine/system_calls.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 50c28549f..71e901822 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -5940,6 +5940,7 @@ impl Machine { } self.user_input = stream; + self.indices.set_stream(atom!("user_input"), stream); Ok(()) } @@ -5964,6 +5965,7 @@ impl Machine { } self.user_output = stream; + self.indices.set_stream(atom!("user_output"), stream); Ok(()) }