* Stop with an error signal
@ 2010-10-30 23:27 Aditya Mahajan
2010-10-31 4:25 ` Wolfgang Schuster
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Aditya Mahajan @ 2010-10-30 23:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
I want to write a macro that checks for some settings and if the settings
are wrong stop the current compilation and terminate with an error
message. Right now I have
\def\ERROR
{\writeline
\showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
\batchmode
\normalend}
This prints the error message on the terminal and exits. However the exit
status (the value of $?) is 0, if the tui file has changed the document is
compiled a second time anyways.
How can I force context (the macro package) to exit with a status of 1 so
that context (the program) does not attempt a second compilation?
Thanks.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-30 23:27 Stop with an error signal Aditya Mahajan
@ 2010-10-31 4:25 ` Wolfgang Schuster
2010-10-31 4:44 ` Aditya Mahajan
2010-10-31 5:04 ` Khaled Hosny
2010-10-31 8:46 ` Wolfgang Schuster
2 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2010-10-31 4:25 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 31.10.2010 um 01:27 schrieb Aditya Mahajan:
> Hi,
>
> I want to write a macro that checks for some settings and if the settings are wrong stop the current compilation and terminate with an error message. Right now I have
>
> \def\ERROR
> {\writeline
> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
> \batchmode
> \normalend}
>
> This prints the error message on the terminal and exits. However the exit status (the value of $?) is 0, if the tui file has changed the document is compiled a second time anyways.
>
> How can I force context (the macro package) to exit with a status of 1 so that context (the program) does not attempt a second compilation?
\starttext
one
\scrollmode\undefined\forcequitjob{bye}
two
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-31 4:25 ` Wolfgang Schuster
@ 2010-10-31 4:44 ` Aditya Mahajan
2010-10-31 5:01 ` Aditya Mahajan
0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2010-10-31 4:44 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, 31 Oct 2010, Wolfgang Schuster wrote:
>
> Am 31.10.2010 um 01:27 schrieb Aditya Mahajan:
>
>> Hi,
>>
>> I want to write a macro that checks for some settings and if the settings are wrong stop the current compilation and terminate with an error message. Right now I have
>>
>> \def\ERROR
>> {\writeline
>> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
>> \batchmode
>> \normalend}
>>
>> This prints the error message on the terminal and exits. However the exit status (the value of $?) is 0, if the tui file has changed the document is compiled a second time anyways.
>>
>> How can I force context (the macro package) to exit with a status of 1 so that context (the program) does not attempt a second compilation?
>
> \starttext
>
> one
>
> \scrollmode\undefined\forcequitjob{bye}
>
> two
>
> \stoptext
\forcequitjob is defined in the same manner as my definition
\def\forcequitjob#1%
{\writestatus\m!systems{forcing quit: #1}%
\batchmode
\dorecurse\textlevel{\stoptext}
\normalend}
and suffers from the same problem. It does not send the program's error
code to 1. After compiling
\starttext
\forcequitjob{bye}
\stoptext
the output of `echo $?` is 0, so context thinks that the program compiled
sucessfully.
Now add
\section{one}
on the first line and compile again. Context does two runs of the program
(because no error signal is generated at the end of the first run). I want
to avoid this second run.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-31 4:44 ` Aditya Mahajan
@ 2010-10-31 5:01 ` Aditya Mahajan
0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2010-10-31 5:01 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, 31 Oct 2010, Aditya Mahajan wrote:
>>> How can I force context (the macro package) to exit with a status of 1 so
>>> that context (the program) does not attempt a second compilation?
Adding \errmessage{} before \normalend changes the error code to 1.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-30 23:27 Stop with an error signal Aditya Mahajan
2010-10-31 4:25 ` Wolfgang Schuster
@ 2010-10-31 5:04 ` Khaled Hosny
2010-10-31 5:08 ` Aditya Mahajan
2010-10-31 8:46 ` Wolfgang Schuster
2 siblings, 1 reply; 9+ messages in thread
From: Khaled Hosny @ 2010-10-31 5:04 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sat, Oct 30, 2010 at 07:27:02PM -0400, Aditya Mahajan wrote:
> Hi,
>
> I want to write a macro that checks for some settings and if the
> settings are wrong stop the current compilation and terminate with
> an error message. Right now I have
>
> \def\ERROR
> {\writeline
> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
> \batchmode
> \normalend}
Well, the first thought that came in my mind is using os.exit(1):
\def\ERROR{\directlua{os.exit(1)}}
But since this is pretty obvious, I'm sure I'm missing something.
Regards,
Khaled
--
Khaled Hosny
Arabic localiser and member of Arabeyes.org team
Free font developer
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-31 5:04 ` Khaled Hosny
@ 2010-10-31 5:08 ` Aditya Mahajan
2010-10-31 5:12 ` Khaled Hosny
0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2010-10-31 5:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, 31 Oct 2010, Khaled Hosny wrote:
> On Sat, Oct 30, 2010 at 07:27:02PM -0400, Aditya Mahajan wrote:
>> Hi,
>>
>> I want to write a macro that checks for some settings and if the
>> settings are wrong stop the current compilation and terminate with
>> an error message. Right now I have
>>
>> \def\ERROR
>> {\writeline
>> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
>> \batchmode
>> \normalend}
>
> Well, the first thought that came in my mind is using os.exit(1):
>
> \def\ERROR{\directlua{os.exit(1)}}
>
> But since this is pretty obvious, I'm sure I'm missing something.
I want the code to also work with MkII, so I did not even think of a lua
solution :)
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-31 5:08 ` Aditya Mahajan
@ 2010-10-31 5:12 ` Khaled Hosny
2010-10-31 5:19 ` Aditya Mahajan
0 siblings, 1 reply; 9+ messages in thread
From: Khaled Hosny @ 2010-10-31 5:12 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, Oct 31, 2010 at 01:08:40AM -0400, Aditya Mahajan wrote:
> On Sun, 31 Oct 2010, Khaled Hosny wrote:
>
> >On Sat, Oct 30, 2010 at 07:27:02PM -0400, Aditya Mahajan wrote:
> >>Hi,
> >>
> >>I want to write a macro that checks for some settings and if the
> >>settings are wrong stop the current compilation and terminate with
> >>an error message. Right now I have
> >>
> >>\def\ERROR
> >> {\writeline
> >> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
> >> \batchmode
> >> \normalend}
> >
> >Well, the first thought that came in my mind is using os.exit(1):
> >
> >\def\ERROR{\directlua{os.exit(1)}}
> >
> >But since this is pretty obvious, I'm sure I'm missing something.
>
> I want the code to also work with MkII, so I did not even think of a
> lua solution :)
For some reason I was assuming the external filter module is MkIV only
thing, now I wounder from where I got that impression.
Regards,
Khaled
--
Khaled Hosny
Arabic localiser and member of Arabeyes.org team
Free font developer
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-31 5:12 ` Khaled Hosny
@ 2010-10-31 5:19 ` Aditya Mahajan
0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2010-10-31 5:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, 31 Oct 2010, Khaled Hosny wrote:
> On Sun, Oct 31, 2010 at 01:08:40AM -0400, Aditya Mahajan wrote:
>> On Sun, 31 Oct 2010, Khaled Hosny wrote:
>>
>>> On Sat, Oct 30, 2010 at 07:27:02PM -0400, Aditya Mahajan wrote:
>>>> Hi,
>>>>
>>>> I want to write a macro that checks for some settings and if the
>>>> settings are wrong stop the current compilation and terminate with
>>>> an error message. Right now I have
>>>>
>>>> \def\ERROR
>>>> {\writeline
>>>> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
>>>> \batchmode
>>>> \normalend}
>>>
>>> Well, the first thought that came in my mind is using os.exit(1):
>>>
>>> \def\ERROR{\directlua{os.exit(1)}}
>>>
>>> But since this is pretty obvious, I'm sure I'm missing something.
>>
>> I want the code to also work with MkII, so I did not even think of a
>> lua solution :)
>
> For some reason I was assuming the external filter module is MkIV only
> thing, now I wounder from where I got that impression.
I had some functionality (running content through webservers) that was
MkIV only, but I decided to remove that. Maybe that is what give you the
MkIV only imression.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Stop with an error signal
2010-10-30 23:27 Stop with an error signal Aditya Mahajan
2010-10-31 4:25 ` Wolfgang Schuster
2010-10-31 5:04 ` Khaled Hosny
@ 2010-10-31 8:46 ` Wolfgang Schuster
2 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2010-10-31 8:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 31.10.2010 um 01:27 schrieb Aditya Mahajan:
> Hi,
>
> I want to write a macro that checks for some settings and if the settings are wrong stop the current compilation and terminate with an error message. Right now I have
>
> \def\ERROR
> {\writeline
> \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
> \batchmode
> \normalend}
>
> This prints the error message on the terminal and exits. However the exit status (the value of $?) is 0, if the tui file has changed the document is compiled a second time anyways.
>
> How can I force context (the macro package) to exit with a status of 1 so that context (the program) does not attempt a second compilation?
\starttext
\scrollmode\errmessage{...}
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-10-31 8:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-30 23:27 Stop with an error signal Aditya Mahajan
2010-10-31 4:25 ` Wolfgang Schuster
2010-10-31 4:44 ` Aditya Mahajan
2010-10-31 5:01 ` Aditya Mahajan
2010-10-31 5:04 ` Khaled Hosny
2010-10-31 5:08 ` Aditya Mahajan
2010-10-31 5:12 ` Khaled Hosny
2010-10-31 5:19 ` Aditya Mahajan
2010-10-31 8:46 ` Wolfgang Schuster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).