if (CONSP (buffer))
{
if (CONSP (XCONS (buffer)->cdr))
- error_file = Fexpand_file_name (XCONS (XCONS (buffer)->cdr)->car,
- Qnil);
+ {
+ Lisp_Object stderr_file;
+ stderr_file = XCONS (XCONS (buffer)->cdr)->car;
+
+ if (NILP (stderr_file) || EQ (Qt, stderr_file))
+ error_file = stderr_file;
+ else
+ error_file = Fexpand_file_name (stderr_file, Qnil);
+ }
+
buffer = XCONS (buffer)->car;
}
if (outfilefd < 0)
{
close (filefd);
- report_file_error ("Opening process output file", Fcons (tempfile, Qnil));
+ report_file_error ("Opening process output file",
+ Fcons (build_string (tempfile), Qnil));
}
+ fd[0] = filefd;
fd[1] = outfilefd;
-#endif
+#endif /* MSDOS */
if (INTEGERP (buffer))
fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1;
else
{
#ifndef MSDOS
-#ifdef WINDOWSNT
- pipe_with_inherited_out (fd);
-#else /* not WINDOWSNT */
pipe (fd);
-#endif /* not WINDOWSNT */
#endif
#if 0
/* Replaced by close_process_descs */
if (fd_error < 0)
{
close (filefd);
- close (fd[0]);
+ if (fd[0] != filefd)
+ close (fd[0]);
if (fd1 >= 0)
close (fd1);
- report_file_error ("Cannot open", error_file);
+#ifdef MSDOS
+ unlink (tempfile);
+#endif
+ report_file_error ("Cannot redirect stderr",
+ Fcons ((NILP (error_file)
+ ? build_string (NULL_DEVICE) : error_file),
+ Qnil));
}
#ifdef MSDOS /* MW, July 1993 */
/* ??? Someone who knows MSDOG needs to check whether this properly
{
if (fd[0] >= 0)
close (fd[0]);
-#ifdef USG
+#if defined(USG) && !defined(BSD_PGRPS)
setpgrp ();
#else
setpgrp (pid, pid);
child_setup (filefd, fd1, fd_error, new_argv, 0, current_dir);
}
#endif /* not WINDOWSNT */
+
+ /* The MSDOS case did this already. */
+ if (fd_error >= 0)
+ close (fd_error);
#endif /* not MSDOS */
environ = save_environ;
/* Close most of our fd's, but not fd[0]
since we will use that to read input from. */
close (filefd);
- if (fd1 >= 0)
+ if (fd1 >= 0 && fd1 != fd_error)
close (fd1);
}
tempfile = alloca (20);
*tempfile = '\0';
}
- dostounix_filename (tempfile);
if (!IS_DIRECTORY_SEP (tempfile[strlen (tempfile) - 1]))
strcat (tempfile, "/");
+ if ('/' == DIRECTORY_SEP)
+ dostounix_filename (tempfile);
+ else
+ unixtodos_filename (tempfile);
#ifdef WINDOWSNT
strcat (tempfile, "emXXXXXX");
#else
char *pwd_var;
#ifdef WINDOWSNT
int cpid;
- HANDLE handles[4];
+ HANDLE handles[3];
#endif /* WINDOWSNT */
int pid = getpid ();
close (err);
#endif /* not WINDOWSNT */
-#ifdef USG
+#if defined(USG) && !defined(BSD_PGRPS)
#ifndef SETPGRP_RELEASES_CTTY
setpgrp (); /* No arguments but equivalent in this case */
#endif
environ = env;
execvp (new_argv[0], new_argv);
- write (1, "Can't exec program: ", 26);
+ write (1, "Can't exec program: ", 20);
write (1, new_argv[0], strlen (new_argv[0]));
write (1, "\n", 1);
_exit (1);