help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: run emacs in batch mode without a tty


From: Sam Halliday
Subject: Re: run emacs in batch mode without a tty
Date: Fri, 3 Jul 2015 14:52:43 -0700 (PDT)
User-agent: G2/1.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]