public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Catching lua pandoc.pipe() errors
@ 2021-08-19 10:38 William Lupton
       [not found] ` <CAEe_xxhWuGPjZ0Gaw2PBp=VnCjFwOVeMsYr2kN4gxqrSynAP-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: William Lupton @ 2021-08-19 10:38 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

All,

I've been using pandoc.pipe() in a lua filter, protected by pcall().
Something like this:

    local succeeded, result = pcall(pandoc.pipe, prog, args, text)

It seems that if 'prog' doesn't exist then pandoc will exit, and pcall()
doesn't catch the error. Is that correct and, if so, is there a reason for
it? (I'd prefer to be able to catch this case, because it will probably
indicate an error on the part of the markdown author.)

Thanks,
William

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhWuGPjZ0Gaw2PBp%3DVnCjFwOVeMsYr2kN4gxqrSynAP-Q%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 1338 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Catching lua pandoc.pipe() errors
       [not found] ` <CAEe_xxhWuGPjZ0Gaw2PBp=VnCjFwOVeMsYr2kN4gxqrSynAP-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2021-08-20 10:30   ` BPJ
       [not found]     ` <CADAJKhBJJoqjhp=2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: BPJ @ 2021-08-20 10:30 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

Might it work to call which through a pipe, either pandoc's or lua's
io.popen() if the latter isn't disabled? That means two pipings rather than
one, but you will know if the program you want to run exists.


Den tors 19 aug. 2021 12:39William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
skrev:

> All,
>
> I've been using pandoc.pipe() in a lua filter, protected by pcall().
> Something like this:
>
>     local succeeded, result = pcall(pandoc.pipe, prog, args, text)
>
> It seems that if 'prog' doesn't exist then pandoc will exit, and pcall()
> doesn't catch the error. Is that correct and, if so, is there a reason for
> it? (I'd prefer to be able to catch this case, because it will probably
> indicate an error on the part of the markdown author.)
>
> Thanks,
> William
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhWuGPjZ0Gaw2PBp%3DVnCjFwOVeMsYr2kN4gxqrSynAP-Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhWuGPjZ0Gaw2PBp%3DVnCjFwOVeMsYr2kN4gxqrSynAP-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBJJoqjhp%3D2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 2749 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Catching lua pandoc.pipe() errors
       [not found]     ` <CADAJKhBJJoqjhp=2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2021-08-20 11:16       ` William Lupton
  0 siblings, 0 replies; 3+ messages in thread
From: William Lupton @ 2021-08-20 11:16 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2587 bytes --]

Yes! It works. Thanks very much.

On Fri, 20 Aug 2021 at 11:30, BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:

> Might it work to call which through a pipe, either pandoc's or lua's
> io.popen() if the latter isn't disabled? That means two pipings rather than
> one, but you will know if the program you want to run exists.
>
>
> Den tors 19 aug. 2021 12:39William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> skrev:
>
>> All,
>>
>> I've been using pandoc.pipe() in a lua filter, protected by pcall().
>> Something like this:
>>
>>     local succeeded, result = pcall(pandoc.pipe, prog, args, text)
>>
>> It seems that if 'prog' doesn't exist then pandoc will exit, and pcall()
>> doesn't catch the error. Is that correct and, if so, is there a reason for
>> it? (I'd prefer to be able to catch this case, because it will probably
>> indicate an error on the part of the markdown author.)
>>
>> Thanks,
>> William
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhWuGPjZ0Gaw2PBp%3DVnCjFwOVeMsYr2kN4gxqrSynAP-Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhWuGPjZ0Gaw2PBp%3DVnCjFwOVeMsYr2kN4gxqrSynAP-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBJJoqjhp%3D2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBJJoqjhp%3D2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxj-65V0uxHxYtCtAatsJDV88s7g9nHq_JW2FzkYjn6KDA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3932 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-20 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 10:38 Catching lua pandoc.pipe() errors William Lupton
     [not found] ` <CAEe_xxhWuGPjZ0Gaw2PBp=VnCjFwOVeMsYr2kN4gxqrSynAP-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 10:30   ` BPJ
     [not found]     ` <CADAJKhBJJoqjhp=2D5Hze7EFQ-6WLpiEpHa22vbrV3-czD6-FA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-20 11:16       ` William Lupton

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).