[Top][All Lists]

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

Re: Problems with call-process (= identifying run-python issues)

From: Juan José García-Ripoll
Subject: Re: Problems with call-process (= identifying run-python issues)
Date: Wed, 19 Aug 2020 10:59:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

Eli Zaretskii <eliz@gnu.org> writes:
> Is it all needed?  If so, can you explain its role here?
>> Option A:
>> 1. Save files with the specified names and locations
>> 2. Open a command line processor (cmd.exe or PowerShell)
>> 3. Invoke "runemacs -Q --load c:\Users\juanj\Downloads\test.el"
>> Option B:
>> 1. Save files with the specified names
>> 2. Press Windows Key + R (to enter commands)
>> 2. Enter "runemacs -Q --load c:\Users\juanj\Downloads\test.el"
> Then I'm afraid I don't understand what the script chain.cmd does and
> what it expects from Emacs or the user.  Can you please take me though
> this recipe one step at a time?

Ok, let me please explain the problem: I want to run a process that gets
its input from a file, while Emacs collects its output. This is standard
working in many programming modes. For instance, it is the way
run-python calls python to find out the prompt.

I am finding that when I launch Emacs from the windowing environment
(e.g. shortcuts, Start menu, Windows key + R, explorer), Emacs does not
redirect the input of the subprocess properly. If I launch the Emacs
from the command line, the subprocess works as expected. 

To reproduce this I have created a minimal example:

- A bogus input file (foo), that is going to be the redirected input of our

- A script, chain.cmd that copies all input to its output, line by
line. This is going to be the subprocess. Unfortunately, Windows does
not have a 'cat' command, which is why I did it this way.

- An elisp file (test.el) that launches the process with the redirected
input and collects the output

This example can be ran in three different ways:

- Invoking runemacs.exe -Q --load test.el from the command line
- Running the same command with Windows key + R
- Creating a shortcut that does the same.

All ingredients are needed, because we need a reproducible program, an
input file and some sophisticated commands that use Emacs'
call-process. However, it is *not* complicated at all and everything is
pretty standard.

One consequence of this problem is that run-python does not work as
expected (Emacs fails to find the prompt), but as I try to show, this is
not due to Python.

Note that this problem is related to the ispell problems I mentioned
before, but it is not the same. I already knew about the issues I was
experiencing with call-process when using python or other programs, and
those problems made me assume the aspell.exe was experiencing them as
well. *That* analysis was incorrect, but this case is way simpler and it
is reproducible using only Windows tools.



Juan José García Ripoll

reply via email to

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