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.
This commit is contained in:
Emilie Burgun
2025-02-06 22:55:40 +01:00
parent 7f2ce57ba7
commit d8213e29c5

View File

@@ -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(())
}