<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style="font-family:Arial;">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.<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">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?)<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">On Tue, Jan 2, 2018, at 22:34, H.-Dirk Schmitt wrote:<br></div>
<div style="font-family:Arial;">> Here a simple wrapper script would help to :<br></div>
<div style="font-family:Arial;">> - avoid copy and paste errors<br></div>
<div style="font-family:Arial;">> - simplify the fix of this bug<br></div>
<div style="font-family:Arial;">> - simple reuse<br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">> Code outline for an emacs batch wrapper<br></div>
<div style="font-family:Arial;">> ----------------------------------------<br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">> Assume a bash script *emacs_batch* replacing the `-q --batch` options.<br></div>
<div style="font-family:Arial;">> It should take as 1st option the emacs flavour (e.g. emacs25) and pass<br></div>
<div style="font-family:Arial;">> trough all other options except `-q`,<br></div>
<div style="font-family:Arial;">> `--no-init-file` (alias to `-q`) and `--batch`.<br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">> The emacs call could be implemented in this way:<br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">> ```<br></div>
<div style="font-family:Arial;">> declare -r catchFile=$(mktemp) # create temporary file<br></div>
<div style="font-family:Arial;">> for output<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Exit on failure; $(mktemp) || exit</div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">> trap rm --force ${catchFile} # and ensure cleanup<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">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).<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">> ${FLAVOUR} --batch "${cmdlineOptions[@]}" &>"${catchFile}" & # fork<br></div>
<div style="font-family:Arial;">> declare -i emacsPid=$! # and remember<br></div>
<div style="font-family:Arial;">> sleep ${emacsTimeOut} & # fork timeout watch<br></div>
<div style="font-family:Arial;">> declare -i sleepPid=$! # and remember<br></div>
<div style="font-family:Arial;">> wait -n ${emacsPid} ${sleepPid} # -n → wait for the<br></div>
<div style="font-family:Arial;">> next ending job<br></div>
<div style="font-family:Arial;">> declare -r rc=$? # don't forget the exit<br></div>
<div style="font-family:Arial;">> code<br></div>
<div style="font-family:Arial;">> if ! $(kill ${sleepPid})<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">The command substitution is fishy too.I guess you mean simply<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;"> if ! kill $sleepPid<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">or do you actually expect kill to print something?</div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">> then # oops run in timeout<br></div>
<div style="font-family:Arial;">> … add error handling here<br></div>
<div style="font-family:Arial;">> else # emacs terminates<br></div>
<div style="font-family:Arial;">> without timeout<br></div>
<div style="font-family:Arial;">> cat ${catchFile} # forward console output<br></div>
<div style="font-family:Arial;">> exit ${rc} # rc is originating from<br></div>
<div style="font-family:Arial;">> emacs<br></div>
<div style="font-family:Arial;">> fi<br></div>
<div style="font-family:Arial;">> ```<br></div>
<div style="font-family:Arial;">><br></div>
<div style="font-family:Arial;">> <br></div>
<div id="sig930944"><div class="signature"><br></div>
<div class="signature">/* era */<br></div>
<div class="signature"><br></div>
<div class="signature">--<br></div>
<div class="signature">If this were a real .signature, it would suck less. Well, maybe not.<br></div>
</div>
<div style="font-family:Arial;"><br></div>
</body>
</html>