unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Throwing error if process started with call-process returns error exit code
@ 2018-07-19 17:39 Kaushal Modi
  2018-07-19 17:43 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Kaushal Modi @ 2018-07-19 17:39 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hello,

What's the canonical way to check if the process initiated using
call-process failed?

From the signature of this function:

  (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)

, I can manually parse the buffer I set as DESTINATION and look for errors
like "Unknown option" etc.. but that would be too specific to the process I
am running.

So I was wondering if there's a wrapper function I can use readily, or
something that simply tells me if the process passed or failed.

In case of error, I'd like that parent Elisp function to stop further
execution and throw a user-error.
-- 

Kaushal Modi


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

* Re: Throwing error if process started with call-process returns error exit code
  2018-07-19 17:39 Throwing error if process started with call-process returns error exit code Kaushal Modi
@ 2018-07-19 17:43 ` Eli Zaretskii
  2018-07-19 17:58   ` Kaushal Modi
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2018-07-19 17:43 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Thu, 19 Jul 2018 13:39:55 -0400
> 
> What's the canonical way to check if the process initiated using
> call-process failed?

The usual method is to examine the return value of call-process.



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

* Re: Throwing error if process started with call-process returns error exit code
  2018-07-19 17:43 ` Eli Zaretskii
@ 2018-07-19 17:58   ` Kaushal Modi
  0 siblings, 0 replies; 3+ messages in thread
From: Kaushal Modi @ 2018-07-19 17:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Ah yes. Thanks!

I missed reading that in doc-string the first time. That works.

If the return code is not 0, I then just ask the user to see the process
buffer.

On Thu, Jul 19, 2018 at 1:44 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > What's the canonical way to check if the process initiated using
> > call-process failed?
>
> The usual method is to examine the return value of call-process.
>
-- 

Kaushal Modi


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

end of thread, other threads:[~2018-07-19 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19 17:39 Throwing error if process started with call-process returns error exit code Kaushal Modi
2018-07-19 17:43 ` Eli Zaretskii
2018-07-19 17:58   ` Kaushal Modi

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 read-only IMAP folder(s) and NNTP newsgroup(s).