From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Halliday Newsgroups: gmane.emacs.help Subject: Re: run emacs in batch mode without a tty Date: Fri, 3 Jul 2015 14:52:43 -0700 (PDT) Message-ID: References: <74b79522-cff4-4173-ad1c-178ffdce70fd@googlegroups.com> <91362e27-aad2-4aa8-bfa6-d447881103d1@googlegroups.com> <8f6a541f-2324-4d86-85b0-0472bed4f0a3@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1435960527 7447 80.91.229.3 (3 Jul 2015 21:55:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Jul 2015 21:55:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 03 23:55:20 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZB8vV-0006mQ-WA for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Jul 2015 23:55:18 +0200 Original-Received: from localhost ([::1]:42667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZB8vV-0007M5-4l for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Jul 2015 17:55:17 -0400 X-Received: by 10.50.17.102 with SMTP id n6mr20463813igd.2.1435960363550; Fri, 03 Jul 2015 14:52:43 -0700 (PDT) X-Received: by 10.140.96.137 with SMTP id k9mr338551qge.10.1435960363523; Fri, 03 Jul 2015 14:52:43 -0700 (PDT) Original-Path: usenet.stanford.edu!ff1no1214324igc.0!news-out.google.com!4ni39944qgh.1!nntp.google.com!s91no941476qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.13.129.22; posting-account=kRukCAoAAAANs-vsVh9dFwo5kp5pwnPz Original-NNTP-Posting-Host: 82.13.129.22 User-Agent: G2/1.0 Injection-Date: Fri, 03 Jul 2015 21:52:43 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:213123 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105410 Archived-At: 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 p= rogram exits when it runs through the initial script. >=20 > But my tests are starting up a process, attaching a sentinel and then rea= cting 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. >=20 > So my question then becomes: is there a way to stop emacs -batch from ter= minating when it reaches the end of the script? i.e. require an explicit ki= ll-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) ca= lls 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) ca= ll 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 > > > >=20 > > > > > emacs -batch --eval "(princ \"Hello, world\!\n\")" < /dev/null = > foo > > > >=20 > > > > Aah, the difference is that you're using `-batch` > > >=20 > > > Excuse me? It was you who asked specifically about the batch mode: > > >=20 > > > > 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? > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >=20 > > I wasn't aware that there was a flag to turn emacs into a batch process= or. You can invoke commands and load lisp files for purely automated testin= g without the -batch flag, and that is exactly what we are doing. I was cal= ling that batch mode, but now I don't know what to call it. > >=20 > >=20 > > > > 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 ment= ion this as a caveat http://www.emacswiki.org/emacs/BatchMode > > >=20 > > > What do you mean by "start a process"? > >=20 > > I mean start a http://www.gnu.org/software/emacs/manual/html_node/elisp= /Processes.html > >=20 > > > > Is there anything that you can think of that might cause a -batch e= macs to exit early? > > >=20 > > > 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= . > >=20 > > Well, this is literally all the information I have: the stdout > >=20 > > http://fommil.com/github.com/ensime/ensime-emacs/drone/ee99fc5d368cafc2= dd583520f9fe8e9e23faadb6 > >=20 > > from running this script > >=20 > > https://github.com/fommil/ensime-emacs/blob/drone/test/run_emacs_tests.= sh > >=20 > > The last thing we see is the output from this function call (which star= ts the process) https://github.com/fommil/ensime-emacs/blob/drone/ensime-st= artup.el#L215 > >=20 > > So I'm interested to know what implication the -batch flag has for the = functionality of emacs. Specifically: launching/monitoring processes, and n= avigating buffers (i.e. spoofing user actions). > >=20 > > Best regards, > > Sam