unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs exit (return) code?
@ 2002-10-10 19:09 J.D. Baldwin
  2002-10-12  7:02 ` Eli Zaretskii
       [not found] ` <mailman.1034410031.20507.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: J.D. Baldwin @ 2002-10-10 19:09 UTC (permalink / raw)




I am having an odd problem.  In one case it is inconsequential, in
another it is an impediment to the work I'd like to be doing.

The problem is that Emacs returns a nonzero exit code upon exit when
it is invoked from another program, if I have ever canceled a command
from within Emacs with ^G.

For example, if I send a mail message in mutt (version 1.4i, running
on NetBSD 1.6) and I never use ^G, I exit with no problem at all.  If
I ever once use ^G during my session, mutt shows the following error
message upon exit:

    Error running "/usr/local/bin/emacs '/var/tmp/msgfile'"!

That one is no big deal, as I don't lose work, but the next one is a
bit of a problem for me.  I observe the same behavior with the sudo
utility "visudo" (version 1.6.3p7 running on either Solaris 7 or 8).
If I edit a file and never hit ^G, my changes are accepted.  If I ever
hit ^G during my session, I get this message:

    visudo: Editor (/opt/local/bin/emacs) failed with exit status 53248, \
                 /etc/sudoers unchanged.

In that case, my changes are rejected without giving me a chance to
recover them.  (Yes, I know this is brain damage on the part of sudo,
but I can't fix that just now.)

So my questions are:

1. What causes this? and

2. Is there a way to suppress this behavior?

I'm using Emacs 20.7.1 in all cases.
-- 
  _+_ From the catapult of |If anyone disagrees with any statement I make, I
_|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
\      /  baldwin@panix.com|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------

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

* Re: Emacs exit (return) code?
  2002-10-10 19:09 Emacs exit (return) code? J.D. Baldwin
@ 2002-10-12  7:02 ` Eli Zaretskii
       [not found] ` <mailman.1034410031.20507.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2002-10-12  7:02 UTC (permalink / raw)


> From: INVALID_SEE_SIG@example.com (J.D. Baldwin)
> Newsgroups: gnu.emacs.help
> Date: Thu, 10 Oct 2002 19:09:14 +0000 (UTC)
> 
> I observe the same behavior with the sudo
> utility "visudo" (version 1.6.3p7 running on either Solaris 7 or 8).
> If I edit a file and never hit ^G, my changes are accepted.  If I ever
> hit ^G during my session, I get this message:
> 
>     visudo: Editor (/opt/local/bin/emacs) failed with exit status 53248, \
>                  /etc/sudoers unchanged.
> 
> In that case, my changes are rejected without giving me a chance to
> recover them.  (Yes, I know this is brain damage on the part of sudo,
> but I can't fix that just now.)
> 
> So my questions are:
> 
> 1. What causes this? and

Emacs sets things up so that ^G generates a signal, similar to ^C in
other programs.  An interrupted program usually returns the signal in
its exit status.  I think this is what you see.

> 2. Is there a way to suppress this behavior?

Write a short shell script that invokes Emacs and then always returns
a zero status.  Then tell those programs to run the script instead of
Emacs as your editor.

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

* Re: Emacs exit (return) code?
       [not found] ` <mailman.1034410031.20507.help-gnu-emacs@gnu.org>
@ 2002-10-14 15:44   ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2002-10-14 15:44 UTC (permalink / raw)


Eli Zaretskii wrote:

>>From: INVALID_SEE_SIG@example.com (J.D. Baldwin)
>>Newsgroups: gnu.emacs.help
>>Date: Thu, 10 Oct 2002 19:09:14 +0000 (UTC)
>>
>>I observe the same behavior with the sudo
>>utility "visudo" (version 1.6.3p7 running on either Solaris 7 or 8).
>>If I edit a file and never hit ^G, my changes are accepted.  If I ever
>>hit ^G during my session, I get this message:
>>
>>    visudo: Editor (/opt/local/bin/emacs) failed with exit status 53248, \
>>                 /etc/sudoers unchanged.
>>
>>In that case, my changes are rejected without giving me a chance to
>>recover them.  (Yes, I know this is brain damage on the part of sudo,
>>but I can't fix that just now.)
>>
>>So my questions are:
>>
>>1. What causes this? and
>>
> 
> Emacs sets things up so that ^G generates a signal, similar to ^C in
> other programs.  An interrupted program usually returns the signal in
> its exit status.  I think this is what you see.


But if the signal is successfully handled and the program continues, why should
the exit status be affected?


>>2. Is there a way to suppress this behavior?
>>
> 
> Write a short shell script that invokes Emacs and then always returns
> a zero status.  Then tell those programs to run the script instead of
> Emacs as your editor.


I don't think that's a solution.  Emacs could crash or otherwise fail to save

the edited file and the script would report success.

-- 
<a href="mailto:&lt;kevinr&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2002-10-14 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-10 19:09 Emacs exit (return) code? J.D. Baldwin
2002-10-12  7:02 ` Eli Zaretskii
     [not found] ` <mailman.1034410031.20507.help-gnu-emacs@gnu.org>
2002-10-14 15:44   ` Kevin Rodgers

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