GNU bug report logs - #57854
29.0.50; Different exit code in Emacs and terminal for identical process

Previous Next

Package: emacs;

Reported by: dalanicolai <dalanicolai <at> gmail.com>

Date: Fri, 16 Sep 2022 09:41:02 UTC

Severity: normal

Tags: moreinfo

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 57854 <at> debbugs.gnu.org (full text, mbox):

From: dalanicolai <dalanicolai <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 57854 <at> debbugs.gnu.org
Subject: Re: bug#57854: 29.0.50; Different exit code in Emacs and terminal for
 identical process
Date: Fri, 16 Sep 2022 21:44:53 +0200
[Message part 1 (text/plain, inline)]
B.t.w. I am using this command in `toc-mode`, which is available on MELPA.
It is a quite awesome package to add TOC to pdf/djvu files that do not
contain one
(it can optionally do OCR via tesseract). The command is used in the
function
`toc--pdftocgen-add-to-pdf`, where I use the contents of the TOC buffer as
infile,
to add it to the PDF (which is passes as an argument). Maybe this
explanation
makes even more clear what the command is used for (in any case too much
explanation will probably do no harm)

On Fri, 16 Sept 2022 at 21:29, dalanicolai <dalanicolai <at> gmail.com> wrote:

> I don't understand the answer well (my knowledge about computers is very
> limited),
> i.e. I do not immediately understand what it means for a file to be a tty.
>
> But also, I think the isatty() is about the TOC file, i.e. the file given
> as INFILE (after the `<`)
> But I am not giving any INFILE (which would make the command add the TOC
> to the file given as argument),
> Instead I simply provide a single filepath as argument so that the command
> simply prints the TOC.
>
> (I hope this answer makes sense, I might be misunderstanding something)
>
> On Fri, 16 Sept 2022 at 13:00, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> > From: dalanicolai <dalanicolai <at> gmail.com>
>> > Date: Fri, 16 Sep 2022 12:00:09 +0200
>> >
>> > When looking into the `pdftocio` package I find the following piece of
>> code
>> >
>> > ```
>> >     try:
>> >         with open_pdf(path_in) as doc:
>> >             if toc_file.isatty() or print_toc:
>> >                 # no input from user, switch to output mode and extract
>> the toc
>> >                 # of pdf
>> >                 toc = read_toc(doc)
>> >                 if len(toc) == 0:
>> >                     print("error: no table of contents found",
>> file=sys.stderr)
>> >                     sys.exit(1)
>> >
>> >                 if readable:
>> >                     print(pprint_toc(toc))
>> >                 else:
>> >                     print(dump_toc(toc), end="")
>> >                 sys.exit(0)
>> >
>> >             # an input is given, so switch to input mode
>> >             toc = parse_toc(toc_file)
>> >             write_toc(doc, toc)
>> > ```
>>
>> Note that the above distinguishes between TTY and non-TTY input, and
>> call-process works via the non-TTY case, AFAIU.  So maybe what you see
>> is entirely expected?
>>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.