Your emacs-batch script seems to have some issues. I have not reviewed it properly, but e.g. your prevalent use of the declare keyword is definitely a bashism. More generally, making Emacs package compilation more robust is absolutely not a bad idea; but introducing new requirements should also be reflected in the Emacs policy (though honestly not sure what its current status is?) On Tue, Jan 2, 2018, at 22:34, H.-Dirk Schmitt wrote: > Here a simple wrapper script would help to : > - avoid copy and paste errors > - simplify the fix of this bug > - simple reuse > > > Code outline for an emacs batch wrapper > ---------------------------------------- > > Assume a bash script *emacs_batch* replacing the `-q --batch` options.> It > should take as 1st option the emacs flavour (e.g. emacs25) and pass> trough > all other options except `-q`, > `--no-init-file` (alias to `-q`) and `--batch`. > > The emacs call could be implemented in this way: > > ``` > declare -r catchFile=$(mktemp) # create temporary > file> for output
Exit on failure; $(mktemp) || exit > trap rm --force ${catchFile} # and ensure cleanup The trap declaration seems to be wrong (the trap code needs to be a single string and you need to specify which signals and conditions to trap on). > ${FLAVOUR} --batch "${cmdlineOptions[@]}" &>"${catchFile}" & # > fork> declare -i emacsPid=$! # and remember > sleep ${emacsTimeOut} & # fork timeout watch > declare -i sleepPid=$! # and remember > wait -n ${emacsPid} ${sleepPid} # -n → wait for the > next ending job > declare -r rc=$? # don't forget the > exit> code > if ! $(kill ${sleepPid}) The command substitution is fishy too.I guess you mean simply if ! kill $sleepPid or do you actually expect kill to print something? > then # oops run in timeout> > … add error handling here > else # emacs terminates > without timeout > cat ${catchFile} # forward console > output> exit ${rc} # rc is > originating > from> emacs > fi > ``` > > /* era */ -- If this were a real .signature, it would suck less. Well, maybe not.