GNU bug report logs -
#18515
Document call-process behaviour with respect to default-directory
Previous Next
Reported by: Eli Barzilay <eli <at> barzilay.org>
Date: Sun, 21 Sep 2014 03:35:01 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.3
Fixed in version 25.2
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
retitle 18515 Document call-process behaviour with respect to default-directory
quit
Michael Albinus <michael.albinus <at> gmx.de> writes:
>> +The process runs in `default-directory'.
>
> That's not true if `default-directory' is remote.
Aha, good point. This is an important thing to document.
[v2-0001-Mention-that-processes-start-in-default-directory.patch (text/x-diff, inline)]
From 6c450de9b474f1eb6255f8474b3dc5c5be81b9c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v2] Mention that processes start in default-directory
(Bug#18515)
* doc/lispref/processes.texi (Synchronous Processes):
(Asynchronous Processes):
* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that the subprocess starts in
`default-directory' when local, suggest `start-file-process' and
`process-file' otherwise.
---
doc/lispref/processes.texi | 9 ++++++++-
lisp/subr.el | 7 ++++++-
src/callproc.c | 4 ++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2a79cc781f..c76ca025d9 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -301,7 +301,9 @@ Synchronous Processes
This function calls @var{program} and waits for it to finish.
The current working directory of the subprocess is
-@code{default-directory}.
+@code{default-directory} if that is local (as determined by
+@code{unhandled-file-name-directory}), or "~" otherwise. If you want
+to run a process in a remote directory use @code{process-file}.
The standard input for the new process comes from file @var{infile} if
@var{infile} is not @code{nil}, and from the null device otherwise.
@@ -677,6 +679,11 @@ Asynchronous Processes
The original argument list, modified with the actual connection
information, is available via the @code{process-contact} function.
+
+The current working directory of the subprocess is
+@code{default-directory} if that is local (as determined by
+`unhandled-file-name-directory'), or "~" otherwise. If you want to
+run a process in a remote direcotry use @code{start-file-process}.
@end defun
@defun make-pipe-process &rest args
diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..472f931306 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,12 @@ start-process
If you want to separate standard output from standard error, use
`make-process' or invoke the command through a shell and redirect
-one of them using the shell syntax."
+one of them using the shell syntax.
+
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or \"~\"
+otherwise. If you want to run a process in a remote directory
+use `start-file-process'."
(unless (fboundp 'make-process)
(error "Emacs was compiled without subprocess support"))
(apply #'make-process
diff --git a/src/callproc.c b/src/callproc.c
index 6d69e13757..a781e47b17 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -240,6 +240,10 @@ t (mix it with ordinary output), or a file name string.
and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise. If
+you want to run a process in a remote directory use `process-file'.
+
usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
--
2.11.1
This bug report was last modified 8 years and 99 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.