(sent this too early, some edits below)
In the unit tests for the saved states, I have seen that the program searches for a few alternatives of the current executable.
me(Exe) :-
current_prolog_flag(executable, WinExeOS),
(windows stuff).
me(MeSH) :-
absolute_file_name('swipl.sh', MeSH,
[ access(execute),
file_errors(fail)
]),
!.
me(Exe) :-
current_prolog_flag(executable, Exe).
Is the above thing with swipl.sh some legacy code that should be removed anyway? If it is being used, I’d like to change the behavior so that the two swipls for saving the state and running the state can be set by environment variables, like this:
create_state(File, Output, Args) :-
me_run(Run),
me_save(Save),
format(atom(Emulator), '--emulator=~w', [Run]),
append(Args, ['-o', Output, Emulator, '-c', File, '-f', none], AllArgs),
test_dir(TestDir),
debug(save, 'Creating state in ~q using ~q ~q', [TestDir, Save, AllArgs]),
process_create(Save, AllArgs,
[ cwd(TestDir),
stderr(pipe(Err))
]),
...
me_save(Exe) :-
getenv('SWIPL_SAVE', Exe0),
!, Exe = Exe0.
me_save(Exe) :-
me_run(Exe).
me_run(Exe) :-
getenv('SWIPL_RUN', Exe0),
!, Exe = Exe0.
me_run(Exe) :-
current_prolog_flag(executable, Exe).
Any objections? The name of the environment variables is arbitrary, of course.
This solves a tiny problem with for the “save state”-mode, where swipl
refuses the option --sigalert=0
.