Questions tagged [subprocess]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
15
votes
2answers
2k views

How to prevent slow-down when an inferior processes generates long lines?

I use Emacs with Geiser to hack on some Scheme code. As I'm playing around in the REPL I sometimes evaluate expressions that result in a lot of output, often all on one line. For example, I just ...
12
votes
1answer
2k views

Asynchronously wait for output from a comint process

First of all, a disclaimer. I have researched this many times, and I am pretty sure that I have already found the answer one way or another, but I just don't understand it. My problem is the ...
10
votes
1answer
163 views

How do I prevent one subprocess from starving others?

To be clear, I'm not talking about anything that should require emacs to be multithreaded (though that would probably also solve this). To reproduce: emacs -Q # I'm running 24.4.1 Make a second frame ...
9
votes
2answers
938 views

Run ssh-add from Emacs and enter a passphrase

I want to call the ssh-add shell command. So I invoke M-x shell-command RET, and in the minibuffer, I type: ssh-add .ssh/id_rsa The only thing I get is: ssh_askpass: exec(/usr/bin/ssh-askpass): No ...
8
votes
3answers
967 views

Persistent environment for M-x compile

When I run M-x compile it spawns a new subshell to execute my compile command. As soon as the compile command returns, the shell process is killed. I can see why this would be desirable in most cases, ...
6
votes
1answer
296 views

Process input seems buggy in Emacs on OS X

I have a process that I'm trying to send input to on OS X. I'm using Emacs' builtin functions for doing this: process-send-string and process-send-region. However, it seems that there are issues when ...
6
votes
1answer
210 views

Read process output line by line

If there a way to read the output of a subprocess line by line, or at least to get it in small batches? I have a subprocess doing work in the background, and printing a line every time it completes ...
5
votes
2answers
318 views

Temporarily set the `default-directory` for `start-process`

Is it possible to set the default-directory temporarily (e.g., let-bound) when using start-process? If so, how please. (let ((default-directory "/Users/HOME/Desktop/tmp")) (start-process "touch-...
5
votes
1answer
594 views

Capturing stderr of subprocesses

I'm trying to capture stderr separately from stdout for a (synchronous) process run from emacs. I've found one way of doing it based on some code copied from emacs' shell-command function (I don't ...
5
votes
2answers
551 views

Set environment variables for spawned subprocesses

I would like to set the environment variables for a spawned subprocess only. They are controlled by process-environment. The documentation says: binding that variable with let is also reasonable ...
5
votes
1answer
113 views

How to attach/connect two subprocesses?

The general case: Simply put, given that I start two processes (Aand B) with, e.g., async-start-process, what is best way of killing B if A terminates? My specific usecase: I'm debugging embedded ...
5
votes
1answer
236 views

Asynchronous version of shell-command-on-region?

I have a problem which is very similar to this one. I have some text that I'd like to listen to with macOS's say utility. Unfortunately, Emacs locks up when I use shell-command-on-region because it is ...
4
votes
1answer
537 views

How do I pass all the output of process to a function?

I want to call a command asynchronously, and define a function that handles output from that command. I don't want to simply write output to a buffer. According to the Elisp info (36.9.2 Process ...
4
votes
2answers
587 views

What is the syntax for a subshell in eshell?

How to write the analogue of a bash-command like: (cd ../repo && git fast-export master) | darcs convert import repo_master in eshell? Here a subshell is employed to restrict the effect of ...
4
votes
1answer
244 views

How does one create back and forth communication to a process

I am writing an emacs mode that interfaces with a shell process. The shell process is expensive to start which means that I would like to do it once and then send commands to it from emacs as need be. ...
4
votes
1answer
69 views

How to partially block user input while Emacs subprocess is running

I have a custom function that updates the etags file before prompting the user to input a desired tag to be located. Although I am pretty good about setting the current buffer to read-only before ...
3
votes
1answer
68 views

Execute program on string

I am trying to execute an external program on a string. This code works, but it saves the string to a temporary file in order to run call-process. This seems quite roundabout. I'd rather not use a ...
3
votes
2answers
785 views

Interpret terminal escape codes in generic process output

I'm running a (start-process) which spits out terminal escape codes into a buffer and it looks ugly. Is there a mode that will interpret these codes into colors? Something similar to whatever ansi-...
2
votes
3answers
884 views

How can Emacs set an environment/shell variable in a subordinate shell?

I often use subordinate shells within Emacs. (I instantiate these shells with M-x shell.) I put all these shells under auto-save-mode (through my shell-mode-hook; see below). Is there some way that ...
1
vote
1answer
108 views

how to do command substitution in eshell generally (NOT just for loop)

How to do command substitution à la Bash in Eshell, and not just for loops? (Unfortunately, while this question asks my question, its answer only provides Eshell for-loop syntax. So please don't dupe ...
1
vote
1answer
452 views

How to set up Emacs with Clozure CL but without SLIME

I want to manually set up my own Emacs CL environment on Mac OS X 7 without the SLIME package i.e. it will only use Clozure CL. To put it other way, I want to use the Emacs CL just like I use the "...
1
vote
1answer
189 views

How to run a custom formatting tool on save?

While there are packages that format on save, I'd like to be able to run a custom command that auto-formats a file on save. Upon saving it runs an external process that: Takes the buffer as stdin. ...
1
vote
2answers
187 views

Multi-processing via TRAMP with asynchronous shell commands

I found the following code in TRAMP: (defun tramp-adb-handle-shell-command (command &optional output-buffer error-buffer) "Like `shell-command' for Tramp files." (let* ((asynchronous (...
1
vote
1answer
155 views

How to run a command via elisp, completely ignoring its output and status? (fire and forget)

Currently I'm using shell command - which makes a buffer, showing the output, sometimes locking emacs. What is a good way to run a process that: Doesn't make a buffer. Doesn't lock emacs. Ignores ...
1
vote
1answer
56 views

Cleanly terminating asynchronous process after it reads stdin

I'm starting a process with start-process and immediately calling set-process-sentinel to get notifications when it ends. After attaching the sentinel I send the buffer's contents to the process's ...
1
vote
1answer
60 views

Wait for (tex-file) to execute before go on with an elisp script

I wrote a script that reads the .aux and .log files after some replacements in the ·tex file (LaTeX). To achieve this i did: (tex-file) (read-string "Wait to tex-file to complete, then press ENTER:") ...
1
vote
1answer
160 views

Quicklook in dired-mode using a process/sentinel with external viewer

In dired-mode, I use an external quicklook tool on OSX called qlmanage, which pops open a window displaying a human readable image of the file with mouse scrolling capabilities. If I hit the space ...
1
vote
0answers
19 views

How to prevent emacs hanging when 'accept-process-output' is called multiple times on a single process?

I'm running into a bug where Emacs locks up when accept-process-output is being called on the same process multiple times. In this case this is the ispell-process, however I don't think that matters ...
1
vote
1answer
35 views

Troubleshooting a hanging `list-processes`

Normally I'd use M-x list-processes to see what Emacs is running in the background. But in this case list-processes itself hangs. What is the right thing to do in this situation?
1
vote
0answers
32 views

Allow user to interact with subprocess

I would like to call a subprocess, and that subprocess has some interactive behavior. Thus, I would emacs to parse the output of the subprocess, ask the user for input, and then hand that input back ...
1
vote
1answer
85 views

Eshell simple echo in parenthesis not working

Why doesn't the following work in eshell $ (echo "foo") Symbol's function definition is void: echo What I tried: googled eshell parenthesis not working More Context: Eventually I'm trying to ...
1
vote
1answer
67 views

install missing external packages automatically from within emacs

I have some snippets in my config, that depend on external tools. For example I use xmodmap at startup. (if (eq window-system 'x) (if (file-exists-p "/usr/bin/xmodmap") (shell-command "...
1
vote
0answers
227 views

How to avoid slow response by set-process-sentinel to process that produces many lines of output

I am running a command that produces a few thousand lines of output, which I would like to store in a buffer. I want to run it in the background and be alerted when it is finished. The problem is that ...
0
votes
1answer
12 views

Cannot paste text copied from Emacs to synchronous subprocess

TL;DR When trying to paste text copied/killed in Emacs to another program while Emacs is waiting for a synchronous subprocess to finish, the target program hangs until Emacs becomes responsive again. ...
0
votes
1answer
97 views

How to let make-process prompt user in echo area

This works: (make-process :name "test" :command (list "bash" "-c" (concat "echo hello stdout!; " "echo hello stderr! >&2; " "exit 20")) :buffer (generate-new-buffer "...
0
votes
1answer
131 views

redirect stderr to a file in call-process-region

I have been reading the documentation for call-process-region here and I am trying to redirect stderr to a file. from the the documentation, this looks correct (call-process-region beg end perltidy-...
0
votes
2answers
201 views

Windows eshell alias command line arguments.. how?

I have alias msexcel (w32-browser "C:/program files/microsoft office/office12/excel.exe") and this means I can do msexcel from eshell and an asynchronous MS Excel will begin to run. I am looking for ...
0
votes
1answer
239 views

Python server with Elisp Emacs client

Trying to make a small example on how to do IPC with Elisp using Python for the server. My source of information is this Here is the code I have right now. my-process.el (let ((process-connection-...
0
votes
1answer
295 views

communication with remote inferior python shell slowing down code editing

I am working with python code on a remote machine using tramp. Once I start the start the remote python shell, the editor window starts to freeze up for around/under a second second at a time, but ...
0
votes
0answers
19 views

Communicating with an external process from a timer?

Is it possible to communicate with an external process from a timer? Currently Emacs prevents starting a process from a timer, so I was wondering of sending input to the stdin or getting output from ...
0
votes
0answers
48 views

How can I make multiple calls to external binaries?

I want to write an interactive function to Call an external binary Write the output of the binary into a buffer Process the buffer to extracts args for next call Call another external binary using ...
0
votes
0answers
76 views

Retaining focus while displaying graphics windows

NB: The Emacs world uses the word frame to refer to what in most other contexts is called window, and uses the word window to describe something else. In this post, however, the word window always ...