aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/callproc.c b/src/callproc.c
index e064dccd6d3..5eba3271358 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -402,10 +402,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
402 402
403 filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); 403 filefd = emacs_open (SSDATA (infile), O_RDONLY, 0);
404 if (filefd < 0) 404 if (filefd < 0)
405 { 405 report_file_error ("Opening process input file",
406 infile = DECODE_FILE (infile); 406 Fcons (DECODE_FILE (infile), Qnil));
407 report_file_error ("Opening process input file", Fcons (infile, Qnil));
408 }
409 407
410 if (STRINGP (output_file)) 408 if (STRINGP (output_file))
411 { 409 {
@@ -612,6 +610,15 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
612 610
613#ifdef WINDOWSNT 611#ifdef WINDOWSNT
614 pid = child_setup (filefd, fd1, fd_error, new_argv, 0, current_dir); 612 pid = child_setup (filefd, fd1, fd_error, new_argv, 0, current_dir);
613 /* We need to record the input file of this child, for when we are
614 called from call-process-region to create an async subprocess.
615 That's because call-process-region's unwind procedure will
616 attempt to delete the temporary input file, which will fail
617 because that file is still in use. Recording it with the child
618 will allow us to delete the file when the subprocess exits.
619 The second part of this is in delete_temp_file, q.v. */
620 if (pid > 0 && INTEGERP (buffer) && nargs >= 2 && !NILP (args[1]))
621 record_infile (pid, xstrdup (SSDATA (infile)));
615#else /* not WINDOWSNT */ 622#else /* not WINDOWSNT */
616 623
617 /* vfork, and prevent local vars from being clobbered by the vfork. */ 624 /* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -924,7 +931,21 @@ delete_temp_file (Lisp_Object name)
924 /* Suppress jka-compr handling, etc. */ 931 /* Suppress jka-compr handling, etc. */
925 ptrdiff_t count = SPECPDL_INDEX (); 932 ptrdiff_t count = SPECPDL_INDEX ();
926 specbind (intern ("file-name-handler-alist"), Qnil); 933 specbind (intern ("file-name-handler-alist"), Qnil);
934#ifdef WINDOWSNT
935 /* If this is called when the subprocess didn't exit yet, the
936 attempt to delete its input file will fail. In that case, we
937 schedule the file for deletion when the subprocess exits. This
938 is the 2nd part of handling this situation; see the call to
939 record_infile in call-process above, for the first part. */
940 if (!internal_delete_file (name))
941 {
942 Lisp_Object encoded_file = ENCODE_FILE (name);
943
944 record_pending_deletion (SSDATA (encoded_file));
945 }
946#else
927 internal_delete_file (name); 947 internal_delete_file (name);
948#endif
928 unbind_to (count, Qnil); 949 unbind_to (count, Qnil);
929 return Qnil; 950 return Qnil;
930} 951}