ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Stop with an error signal
Date: Sun, 31 Oct 2010 00:44:19 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.01.1010310038420.25168@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <1DE1D6A3-7A98-4981-96DF-C554172E9FF4@gmail.com>

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
___________________________________________________________________________________


  reply	other threads:[~2010-10-31  4:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-30 23:27 Aditya Mahajan
2010-10-31  4:25 ` Wolfgang Schuster
2010-10-31  4:44   ` Aditya Mahajan [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1010310038420.25168@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).