all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Halliday <sam.halliday@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: run emacs in batch mode without a tty
Date: Fri, 3 Jul 2015 14:52:43 -0700 (PDT)	[thread overview]
Message-ID: <b11f0810-5710-4899-8eb2-aa3a46f0f954@googlegroups.com> (raw)
In-Reply-To: <ac8061d2-9984-4ef1-9199-51e47d5c7439@googlegroups.com>

On Friday, 3 July 2015 22:25:10 UTC+1, Sam Halliday  wrote:
> Aha! It would appear that when emacs is started in -batch mode then the program exits when it runs through the initial script.
> 
> But my tests are starting up a process, attaching a sentinel and then reacting to some triggers in that file. Under non-batch mode, emacs stays open until I call `kill-emacs`... but *now* it's dying too early.
> 
> So my question then becomes: is there a way to stop emacs -batch from terminating when it reaches the end of the script? i.e. require an explicit kill-emacs call.

Bah! Even if I (sit-for 30) something else is ending the script early, the app only runs for a few seconds. I've commented out all the (kill-emacs) calls in my code but I can't see what's terminating the app. I've also added a kill-emacs-hook to print the backtrace, and this is all I see:


  backtrace()
  (message "%s" (backtrace))
  (lambda nil (message "%s" (backtrace)))()
  kill-emacs(t)
  command-line()
  normal-top-level()

so I have no idea where the normal-top-level / command-line (kill-emacs) call is being called... since my app should be (sit-for ...)-ing.


> On Friday, 3 July 2015 21:43:27 UTC+1, Sam Halliday  wrote:
> > On Friday, 3 July 2015 21:14:36 UTC+1, Eli Zaretskii  wrote:
> > > > Date: Fri, 3 Jul 2015 10:07:06 -0700 (PDT)
> > > > From: Sam Halliday <sam.halliday@gmail.com>
> > > > 
> > > > >   emacs -batch --eval "(princ \"Hello, world\!\n\")" < /dev/null > foo
> > > > 
> > > > Aah, the difference is that you're using `-batch`
> > > 
> > > Excuse me?  It was you who asked specifically about the batch mode:
> > > 
> > > > Is it possible to run emacs in batch mode without access to a tty? Is there a way to mock a tty for these purposes?
> > >   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 
> > I wasn't aware that there was a flag to turn emacs into a batch processor. You can invoke commands and load lisp files for purely automated testing without the -batch flag, and that is exactly what we are doing. I was calling that batch mode, but now I don't know what to call it.
> > 
> > 
> > > > and that does allow me to do *some* things in the docker container, but emacs seems to just exit when I start a `process`. The docs don't mention this as a caveat http://www.emacswiki.org/emacs/BatchMode
> > > 
> > > What do you mean by "start a process"?
> > 
> > I mean start a http://www.gnu.org/software/emacs/manual/html_node/elisp/Processes.html
> > 
> > > > Is there anything that you can think of that might cause a -batch emacs to exit early?
> > > 
> > > How do you see it exiting early?  Please provide the details of what
> > > you see, as I have no way of trying this on a system similar to yours.
> > 
> > Well, this is literally all the information I have: the stdout
> > 
> > http://fommil.com/github.com/ensime/ensime-emacs/drone/ee99fc5d368cafc2dd583520f9fe8e9e23faadb6
> > 
> > from running this script
> > 
> > https://github.com/fommil/ensime-emacs/blob/drone/test/run_emacs_tests.sh
> > 
> > The last thing we see is the output from this function call (which starts the process) https://github.com/fommil/ensime-emacs/blob/drone/ensime-startup.el#L215
> > 
> > So I'm interested to know what implication the -batch flag has for the functionality of emacs. Specifically: launching/monitoring processes, and navigating buffers (i.e. spoofing user actions).
> > 
> > Best regards,
> > Sam



  reply	other threads:[~2015-07-03 21:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03  9:14 run emacs in batch mode without a tty Sam Halliday
2015-07-03 10:26 ` tomas
     [not found] ` <mailman.6225.1435919180.904.help-gnu-emacs@gnu.org>
2015-07-03 10:28   ` Sam Halliday
2015-07-03 10:45     ` tomas
     [not found]     ` <mailman.6226.1435920329.904.help-gnu-emacs@gnu.org>
2015-07-03 13:27       ` Sam Halliday
2015-07-04  8:30         ` tomas
2015-07-03 12:00 ` Eli Zaretskii
     [not found] ` <mailman.6230.1435924859.904.help-gnu-emacs@gnu.org>
2015-07-03 13:26   ` Sam Halliday
2015-07-03 13:51     ` Eli Zaretskii
2015-07-04  6:56       ` Steinar Bang
2015-07-04  7:32         ` Eli Zaretskii
     [not found]     ` <mailman.6240.1435931463.904.help-gnu-emacs@gnu.org>
2015-07-03 15:07       ` Barry Margolin
2015-07-03 17:48         ` Eli Zaretskii
2015-07-03 20:13         ` Emanuel Berg
2015-07-03 15:42       ` Sam Halliday
2015-07-03 16:29         ` Sam Halliday
2015-07-03 17:51         ` Eli Zaretskii
2015-07-03 17:07       ` Sam Halliday
2015-07-03 20:14         ` Eli Zaretskii
     [not found]         ` <mailman.6254.1435954474.904.help-gnu-emacs@gnu.org>
2015-07-03 20:43           ` Sam Halliday
2015-07-03 21:25             ` Sam Halliday
2015-07-03 21:52               ` Sam Halliday [this message]
2015-07-03 22:01                 ` Sam Halliday
2015-07-04  7:42                   ` Eli Zaretskii
2015-07-03 22:55               ` Barry Margolin
2015-07-03 23:56                 ` Sam Halliday
2015-07-04  7:37                 ` Eli Zaretskii
2015-07-04  7:44               ` Eli Zaretskii
2015-07-04  7:45             ` Eli Zaretskii

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=b11f0810-5710-4899-8eb2-aa3a46f0f954@googlegroups.com \
    --to=sam.halliday@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.