X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lisp%2Fprocess.el;h=0c7b46afcf0faff1b633544b9906e065f9cdd5d0;hp=0e3d478226c10af503d1220fe26ba0e53e32f2cd;hb=716cfba952c1dc0d2cf5c968971f3780ba728a89;hpb=ea1ea793fe6e244ef5555ed983423a204101af13 diff --git a/lisp/process.el b/lisp/process.el index 0e3d478..0c7b46a 100644 --- a/lisp/process.el +++ b/lisp/process.el @@ -33,9 +33,6 @@ ;;; Code: -(defvar binary-process-output) -(defvar buffer-file-type) - (defgroup processes nil "Process, subshell, compilation, and job control support." :group 'external @@ -115,14 +112,10 @@ If you quit, the process is first killed with SIGINT, then with SIGKILL if you quit again before the process exits." (let ((temp (make-temp-name - (concat (file-name-as-directory (temp-directory)) - (if (memq system-type '(ms-dos windows-nt)) "em" "emacs"))))) + (concat (file-name-as-directory (temp-directory)) "emacs")))) (unwind-protect (progn - (if (memq system-type '(ms-dos windows-nt)) - (let ((buffer-file-type binary-process-output)) - (write-region start end temp nil 'silent)) - (write-region start end temp nil 'silent)) + (write-region start end temp nil 'silent) (if deletep (delete-region start end)) (apply #'call-process program temp buffer displayp args)) (ignore-file-errors (delete-file temp))))) @@ -321,34 +314,29 @@ Ouput via `process-send-string' and input via buffer or filter (see `set-process-filter') are stream-oriented. That means UDP datagrams are not guaranteed to be sent and received in discrete packets. (But small datagrams around 500 bytes that are not truncated by `process-send-string' -are usually fine.) Note further that UDP protocol does not guard against +are usually fine.) Note further that UDP protocol does not guard against lost packets." (open-network-stream-internal name buffer host service protocol)) (defun shell-quote-argument (argument) "Quote an argument for passing as argument to an inferior shell." - (if (eq system-type 'ms-dos) - ;; MS-DOS shells don't have quoting, so don't do any. - argument - (if (eq system-type 'windows-nt) - (concat "\"" argument "\"") - ;; Quote everything except POSIX filename characters. - ;; This should be safe enough even for really weird shells. - (let ((result "") (start 0) end) - (while (string-match "[^-0-9a-zA-Z_./]" argument start) - (setq end (match-beginning 0) - result (concat result (substring argument start end) - "\\" (substring argument end (1+ end))) - start (1+ end))) - (concat result (substring argument start)))))) - -(defun exec-to-string (command) - "Execute COMMAND as an external process and return the output of that -process as a string" - ;; by "William G. Dubuque" + (if (eq system-type 'windows-nt) + (nt-quote-process-args (list shell-file-name argument)) + ;; Quote everything except POSIX filename characters. + ;; This should be safe enough even for really weird shells. + (let ((result "") (start 0) end) + (while (string-match "[^-0-9a-zA-Z_./]" argument start) + (setq end (match-beginning 0) + result (concat result (substring argument start end) + "\\" (substring argument end (1+ end))) + start (1+ end))) + (concat result (substring argument start))))) + +(defun shell-command-to-string (command) + "Execute shell command COMMAND and return its output as a string." (with-output-to-string (call-process shell-file-name nil t nil shell-command-switch command))) -(defalias 'shell-command-to-string 'exec-to-string) +(defalias 'exec-to-string 'shell-command-to-string) ;;; process.el ends here