With file test.pl:
cat test.pl
:- use_module(library(theme/auto)).
swipl --stand_alone=true -o test -c test.pl
Works fine in Windows.
With file test.pl:
cat test.pl
:- use_module(library(theme/auto)).
swipl --stand_alone=true -o test -c test.pl
Works fine in Windows.
When I tried this on Ubuntu 20.04.3 (Linux 5.10.16.3-microsoft-standard-WSL2):
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.28)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- debug.
true.
[debug] ?- use_module(library(theme/auto)).
ERROR: /usr/lib/swi-prolog/library/theme/auto.pl:61: Initialization goal raised exception:
ERROR: I/O error in read on stream user_input (Interrupted system call)
ERROR: In:
ERROR: [60] get_code(_7298)
ERROR: [59] ansi_term:try_read_pattern(user_input,[27,93|...],[_7356|_7358],_7340) at /usr/lib/swi-prolog/library/ansi_term.pl:495
ERROR: [58] ansi_term:read_pattern(user_input,[27,93|...],[]) at /usr/lib/swi-prolog/library/ansi_term.pl:484
ERROR: [57] ansi_term:exchange_pattern(11,[27,93|...]) at /usr/lib/swi-prolog/library/ansi_term.pl:476
ERROR: [56] <meta call>
ERROR: [55] with_tty_raw(exchange_pattern(11,[27|...])) <foreign>
ERROR: [54] time:run_alarm_goal('$alarm'(94797246574928),ansi_term:with_tty_raw(...)) at /usr/lib/swi-prolog/library/time.pl:147
ERROR: [53] setup_call_catcher_cleanup(time:alarm(0.05,...,...,...),time:run_alarm_goal(...,...),_7606,time:remove_alarm_notrace(...)) at /usr/lib/swi-prolog/boot/init.pl:646
ERROR: [52] setup_call_cleanup(time:alarm(0.05,...,...,...),time:run_alarm_goal(...,...),time:remove_alarm_notrace(...)) at /usr/lib/swi-prolog/boot/init.pl:651
ERROR: [51] time:call_with_time_limit(0.05,ansi_term:with_tty_raw(...)) at /usr/lib/swi-prolog/library/time.pl:138
ERROR: [50] ansi_term:ansi_get_color_(11,rgb(_7808,_7810,_7812)) at /usr/lib/swi-prolog/library/ansi_term.pl:453
ERROR: [49] setup_call_catcher_cleanup(ansi_term:stream_position_data(line_position,...,0),ansi_term:ansi_get_color_(11,...),_7846,ansi_term:set_stream(user_output,...)) at /usr/lib/swi-prolog/boot/init.pl:646
ERROR: [48] setup_call_cleanup(ansi_term:stream_position_data(line_position,...,0),ansi_term:ansi_get_color_(11,...),ansi_term:set_stream(user_output,...)) at /usr/lib/swi-prolog/boot/init.pl:651
ERROR: [47] ansi_term:keep_line_pos(user_output,ansi_term:ansi_get_color_(11,...)) at /usr/lib/swi-prolog/library/ansi_term.pl:404
ERROR: [46] catch(ansi_term:keep_line_pos(user_output,...),time_limit_exceeded,ansi_term:no_xterm) at /usr/lib/swi-prolog/boot/init.pl:546
ERROR: [45] ansi_term:ansi_get_color(background,rgb(_8102,_8104,_8106)) at /usr/lib/swi-prolog/library/ansi_term.pl:434
ERROR: [44] prolog_theme_auto:theme(dark) at /usr/lib/swi-prolog/library/theme/auto.pl:49
ERROR: [43] prolog_theme_auto:load_theme at /usr/lib/swi-prolog/library/theme/auto.pl:56
ERROR: [42] '$run_init_goal'(prolog_theme_auto:load_theme) at /usr/lib/swi-prolog/boot/init.pl:796
ERROR: [41] catch(system:'$run_init_goal'(...),_8242,system:'$initialization_error'(_8264,...,...)) at /usr/lib/swi-prolog/boot/init.pl:546
ERROR: [40] catch_with_backtrace(system:'$run_init_goal'(...),_8300,system:'$initialization_error'(_8322,...,...)) at /usr/lib/swi-prolog/boot/init.pl:614
true.
It works fine here. The auto
theme is a pretty complicated thing. It tries to figure out the current theme by trying to get the background color of the terminal from which it is started. There is no portable way to find out. Some terminals you can send a sequence of characters and it will reply with a sequence that tells you what the color mapping is. Others, like @peter.ludemann’s don’t reply.
I’d not put theme loading into a saved state …
Thanks Jan. This was more an incidental finding that I thought worth reporting rather than a real issue for me.