all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* process communication help
@ 2007-05-29  6:12 Yu,Gang
  0 siblings, 0 replies; 8+ messages in thread
From: Yu,Gang @ 2007-05-29  6:12 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 2169 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 3988 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-05-30  7:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1377.1180419176.32220.help-gnu-emacs@gnu.org>
2007-05-29  8:00 ` process communication help Thien-Thi Nguyen
2007-05-29  9:08   ` Yu,Gang
2007-05-29 10:19     ` Yu,Gang
     [not found]   ` <mailman.1381.1180429716.32220.help-gnu-emacs@gnu.org>
2007-05-29 10:22     ` Thien-Thi Nguyen
2007-05-29 11:57       ` Yu,Gang
     [not found]       ` <mailman.1388.1180439874.32220.help-gnu-emacs@gnu.org>
2007-05-29 15:08         ` Thien-Thi Nguyen
2007-05-30  7:53           ` Yu,Gang
2007-05-29  6:12 Yu,Gang

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.