Questions tagged [subprocess]
52 questions
15
votes
2 answers
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 played with SRFI-41 (streams) and created a character…
user2005
13
votes
1 answer
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 following:
I have a process running through comint
I want…

T. Verron
- 4,233
- 1
- 22
- 55
10
votes
1 answer
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
Switch back to first frame
M-x shell
M-x…

Joseph Garvin
- 2,061
- 8
- 21
10
votes
2 answers
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 such file or directory^M
How can I make Emacs give…

Nsukami _
- 6,341
- 2
- 22
- 35
9
votes
1 answer
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 doing this on OS X. Specifically, it seems that I…

GDP2
- 1,340
- 9
- 25
9
votes
3 answers
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, but I am currently in a situation where it is…

nispio
- 8,175
- 2
- 35
- 73
8
votes
3 answers
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 practice.
In this example I try to unset HOME…

antonio
- 1,762
- 12
- 24
8
votes
1 answer
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 a task. There are many such small tasks, so I…

Clément
- 3,924
- 1
- 22
- 37
6
votes
2 answers
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-file" nil "touch" "test.txt"))
start-process…

lawlist
- 18,826
- 5
- 37
- 118
5
votes
1 answer
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.
Outputs to a temporary file.
After that:
The…

ideasman42
- 8,375
- 1
- 28
- 105
5
votes
1 answer
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 not asynchronous. In other words, Emacs waits…

GDP2
- 1,340
- 9
- 25
5
votes
1 answer
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 software on an external chip and launch a GDB server…

thomsten
- 53
- 3
5
votes
1 answer
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 want to use shell-command directly because there is…

dshepherd
- 1,281
- 6
- 18
4
votes
2 answers
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 cd.

imz -- Ivan Zakharyaschev
- 591
- 6
- 20
4
votes
1 answer
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 going about other activities, sometimes I forget and…

lawlist
- 18,826
- 5
- 37
- 118