From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Yu,Gang" Newsgroups: gmane.emacs.help Subject: process communication help Date: Tue, 29 May 2007 14:12:46 +0800 Message-ID: <48378d570705282312x6c93775fh52052929f6512734@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2066589850==" X-Trace: sea.gmane.org 1180419195 28020 80.91.229.12 (29 May 2007 06:13:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 May 2007 06:13:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 29 08:13:14 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HsuxF-0003fX-BA for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 08:13:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HsuxC-0007tb-NC for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 02:13:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hsuwx-0007tV-Ec for help-gnu-emacs@gnu.org; Tue, 29 May 2007 02:12:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hsuwv-0007tI-UO for help-gnu-emacs@gnu.org; Tue, 29 May 2007 02:12:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hsuwv-0007tF-RZ for help-gnu-emacs@gnu.org; Tue, 29 May 2007 02:12:53 -0400 Original-Received: from nz-out-0506.google.com ([64.233.162.239]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hsuwv-0007Wf-HZ for help-gnu-emacs@gnu.org; Tue, 29 May 2007 02:12:53 -0400 Original-Received: by nz-out-0506.google.com with SMTP id z3so1369272nzf for ; Mon, 28 May 2007 23:12:47 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=Hqp57AH/1c5Dmn5piE38JtSgOWhfqXZ+dbhRM3EUXzckzqWhWDP2etvq3CdBXRku3YLURse/TXgDQZIiqd1YH26G1DLzp7rA58sgX46vPX+e234apG7wPjdfs0HhsAbb4DPxpDStTMVfYDbLtl6sCJ6OiI3rIjUryzTuAXmHMIA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=jozAn10MLc8TtWScc7V7jAefEsbVi/PRgXc7zp5YgSPLi6vj9w4jNWQcS4wGKF+UFyHydy/xoHF061QLHlYWb+JNTlqBse1GapElTzVrY86iNNEeMdYA31aL0TJqMjGmyKUCwmgk7QqB3pzt6nzHwtYhtM22G/Gnn4PpqichNr8= Original-Received: by 10.114.127.1 with SMTP id z1mr3265178wac.1180419166694; Mon, 28 May 2007 23:12:46 -0700 (PDT) Original-Received: by 10.114.60.1 with HTTP; Mon, 28 May 2007 23:12:46 -0700 (PDT) X-detected-kernel: Linux 2.4-2.6 (Google crawlbot) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44517 Archived-At: --===============2066589850== Content-Type: multipart/alternative; boundary="----=_Part_3002_2791304.1180419166644" ------=_Part_3002_2791304.1180419166644 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi ,all: I get a problem, when I want to get sub-a process output from the buffer. Here is the code, in my .emacs: (defun startup (check-command wanted start-command) "check whether the 'wanted' state satisfied, if not, launch the start-command" (interactive) (save-excursion (let* ((d-buf (get-buffer-create "diagnose")) (process-connection-type nil) (process-status (eval `(call-process (car check-command) nil d-buf t ,@(cdr check-command))))) (print `(,(buffer-modified-p) ,(buffer-size) ,(point-min) ,(point) ,(point-max)) d-buf) ;;(debug) (if (not (string-match wanted (buffer-string))) (progn (print (concat "starting command " (stringlist-to-string start-command " ")) d-buf) (eval `(start-process "start up" d-buf (car start-command) ,@(cdr start-command))) ) (print (concat wanted " matched! no need to start " (stringlist-to-string start-command " ")) d-buf) )))) (setq system-start-up-list '((("sudo" "netstat" "-i") "eth0" ("sudo" "ifup" "eth0"))) ) ;;(debug-on-entry 'startup) (mapcar (lambda (ssup-item) (let ((check-command (car ssup-item)) (wanted (cadr ssup-item)) (start-command (caddr ssup-item))) (startup check-command wanted start-command)) ) system-start-up-list) Something strange is that, I get the following in my diagnose buffer: Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 3959 0 0 0 1903 0 0 0 BMRU lo 16436 0 122 0 0 0 122 0 0 0 LRU (nil 0 1 1 1) "starting command sudo ifup eth0" ifup: interface eth0 already configured Process start up finished It seems that , string " Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 3959 0 0 0 1903 0 0 0 BMRU lo 16436 0 122 0 0 0 122 0 0 0 LRU " could not be read by the (buffer-string) :( How can I solve the problem? thanks cheers -- YuGang ------=_Part_3002_2791304.1180419166644 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi ,all:

   I get a problem, when I want to get sub-a process output from the buffer.

Here is the code, in my .emacs:

(defun startup (check-command wanted start-command)
  "check whether the 'wanted' state satisfied, if not, launch the start-command"
  (interactive)
  (save-excursion
    (let* ((d-buf (get-buffer-create "diagnose"))
       (process-connection-type nil)
       (process-status (eval `(call-process (car check-command) nil d-buf t ,@(cdr check-command)))))
      (print `(,(buffer-modified-p) ,(buffer-size) ,(point-min) ,(point) ,(point-max)) d-buf)
      ;;(debug)
      (if (not (string-match wanted (buffer-string)))
      (progn
        (print (concat "starting command " (stringlist-to-string start-command " ")) d-buf)
        (eval `(start-process "start up" d-buf (car start-command) ,@(cdr start-command)))
        )
    (print
     (concat wanted " matched! no need to start " (stringlist-to-string start-command " ")) d-buf)
    ))))
 
(setq system-start-up-list
      '((("sudo" "netstat" "-i") "eth0" ("sudo" "ifup" "eth0")))
    )

;;(debug-on-entry 'startup)

(mapcar (lambda (ssup-item)
      (let ((check-command (car ssup-item))
        (wanted (cadr ssup-item))
        (start-command (caddr ssup-item)))
        (startup check-command wanted start-command))
      ) system-start-up-list)

Something strange is that, I get the following in my diagnose buffer:

Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0   1500 0      3959      0      0      0     1903      0      0      0 BMRU
lo    16436 0       122      0      0      0      122      0      0      0 LRU

(nil 0 1 1 1)

"starting command sudo ifup eth0"
ifup: interface eth0 already configured

Process start up finished

It seems that , string
"
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0   1500 0      3959      0      0      0     1903      0      0      0 BMRU
lo    16436 0       122      0      0      0      122      0      0      0 LRU
" could not be read by the (buffer-string) :(

How can I solve the problem? thanks

cheers


--
YuGang ------=_Part_3002_2791304.1180419166644-- --===============2066589850== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============2066589850==--