5
votes
Accepted
Set environment variables for spawned subprocesses
setenv-internal and setenv change the list stored in process-environment (as local or special variable) by side-effects.
It does not help if you assign the list (pointer) to a local variable process-...
5
votes
Accepted
How to call "echo ${GOPATH}" with call-process?
You're looking for (call-process-shell-command "echo ${GOPATH}" nil t nil). In this case, ${PATH} is syntax defined by a shell, not a native call, so you'll need to invoke a shell to interpret it.
...
4
votes
Differences between cmdproxy.exe and cmd.exe
I just found this:
Proxy shell designed for use with Emacs on Windows 95 and NT. [...]
The main function is simply to process the "-c string" option in the way /bin/sh does, since the standard ...
3
votes
Ignore stderr when calling call-shell-region
Your list is quoted, so you are passing in a list with two symbols rather than a buffer and nil. Use list rather than quote:
(call-shell-region (point-min) (point-max)
(concat "...
3
votes
Accepted
How to start a persistent asynchronous process trough emacs?
You can use call-process the same way as you did, but just replace the third argument by 0. If the third argument is 0, Emacs don't wait for the process and quit without killing it.
SHELL-PROMPT> ...
3
votes
Why does :command argument of make-process not work when string passed as a variable?
You've quoted the list:
:command '("sh" "-c" body)
So you have passed it a symbol body not the string value of the variable.
Try:
:command (list "sh" "-c" body)
or:
:command `("sh" "-...
3
votes
Run a process synchronously and obtain stdout and stderr in different buffers?
The c-function call-process is the basis for creating synchronous processes in Emacs. So you don't get more with any other functions.
The info page (elisp) Synchronous Processes contains the ...
2
votes
Set environment variables for spawned subprocesses
The "let binding" way is the following (notice that contrary to Tobias's answer, this does not involve any copying or "set"ting):
(let ((process-environment
(cons "HOME"
(cons (...
2
votes
Accepted
How to send quoted argument to call-process
I would like to run convert - -draw 'rectangle 0,0,100,100' -
Note that you're quoting for the shell there, so that it will not break that argument into two, on account of the space.
For example I ...
2
votes
Cannot paste text copied from Emacs to synchronous subprocess
There are several ways of copying text between programs on Linux. I'm just guessing that you're using Linux, but I don't think that this problem could occur on Windows or OSX. I also surmise that you'...
2
votes
How to pipe data through multiple processes?
Use the system shell, e.g., M-! ls | wc, there are many other APIs such as shell-command-to-string, call-process-shell-command and start-process-shell-command.
An idea is emulating pipe like the ...
2
votes
Elisp function to open file name with space?
I recommend using call-process instead of shell-command:
(defun open-a-file ()
(interactive)
(call-process "xdg-open" nil 0 nil (read-file-name "Open: ")))
One large ...
1
vote
Accepted
Getting the PID of process initiated with call-process
Here's a somewhat silly implementation of a function that does a call-process and returns its pid (sort-of):
(defun call-process-pid ()
(let (l1 l2)
(setq l1 (list-system-processes))
(call-...
1
vote
Accepted
shell command on region with process substitution
You can use something like the following with M-|:
cat > tmp.txt && python -m doctest -v tmp.txt
1
vote
Accepted
Run a process synchronously and obtain stdout and stderr in different buffers?
Another way I could do this without rewriting the C code for call-process would be to use make-process and go into a busy-wait loop that is similar to the following:
(defvar my-process-finished nil
&...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
call-process × 18process × 7
shell-command × 4
subprocess × 4
buffers × 1
tramp × 1
shell × 1
git × 1
term × 1
variables × 1
copy-paste × 1
async × 1
newlines × 1
environment × 1
command-line-arguments × 1
focus × 1
filenames × 1
pipe × 1