There should probably be a way with Reply as Value
to convert the stream data to a more usable type:
1 ?- use_module(library(redis)).
true.
2 ?- redis(default,xrange(mys,-,+),R). % with some mock data in the stream
R = [["1603327576388-0", ["type", "backup", "cmd", "dobak", "outcome", "sucess"]], ["1603327589307-0", ["type", "backup", "cmd", "dobak", "outcome"|...]], ["1603327611351-0", ["type", "backup", "cmd", "dorestore"|...]], ["1603327651797-0", ["type", "backup", "cmd"|...]], ["1603327669719-0", ["type", "backup"|...]], ["1603327683570-0", ["type"|...]], ["1603395488304-0", [...|...]]].
Also there is a problem with error handling (probably data left in the buffers due to the exception?):
3 ?- redis(default,xrange(mys,-,+),R as dict(auto)).
ERROR: Domain error: `redis_map_length' expected, found `7'
ERROR: In:
ERROR: [19] throw(error(domain_error(redis_map_length,7),_88492))
ERROR: [16] redis:redis_write_msg(<stream>(0x56491604ab00,0x56491604ac00),...),redis:redis_read_stream(default,<stream>(0x56491604ab00,0x56491604ac00),...) at /home/u/tmp/swipl-devel/build.release/home/boot/init.pl:368
ERROR: [15] <meta call>
ERROR: [14] with_mutex(default,(redis_write_msg(<stream>(0x56491604ab00,0x56491604ac00),...),redis_read_stream(default,<stream>(0x56491604ab00,0x56491604ac00),...))) <foreign>
ERROR: [12] catch(redis:redis2(default,...,...),error(_88666,_88668),redis:true) at /home/u/tmp/swipl-devel/build.release/home/boot/init.pl:528
ERROR: [11] redis:redis1(default,xrange(mys,-,+),_88720 as dict(auto)) at /home/u/tmp/swipl-devel/build.release/home/library/redis.pl:517
ERROR: [10] redis:redis(default,xrange(mys,-,+),_88772 as dict(auto)) at /home/u/tmp/swipl-devel/build.release/home/library/redis.pl:505
ERROR: [9] toplevel_call(user:user: ...) at /home/u/tmp/swipl-devel/build.release/home/boot/toplevel.pl:1113
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
4 ?- redis(default,xrange(mys,-,+),R).
R = ["1603327576388-0", ["type", "backup", "cmd", "dobak", "outcome", "sucess"]].
5 ?- redis(default,xrange(mys,-,+),R).
R = ["1603327589307-0", ["type", "backup", "cmd", "dobak", "outcome", "error"]].
5 ?- redis(default,xrange(mys,-,+),R).
R = ["1603327611351-0", ["type", "backup", "cmd", "dorestore", "outcome", "partial success"]].
Notice how after the exception the replies are partial left overs. Also strangely enough the top-level line number did not get updated in the last call.
SIDE NOTE: for some reason the post coloring is off and the commands I typed in the top-level after the exception are colored red)