[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Opening a pty without a process
From: |
Nick Roberts |
Subject: |
Re: Opening a pty without a process |
Date: |
Wed, 28 Nov 2007 12:22:04 +1300 |
> >> (open-pty-buffer buffer)
> -> "/dev/pts/1"
>
> How 'bout:
>
> (defun open-pty-buffer (buffer)
> (let* ((process-connection-type 'pty)
> (proc (start-process "foo" buffer "sh" "-c"
> "while sleep 3600; do :; done")))
> (process-tty-name proc)))
In gdb-mi.el (in ELPA) I do:
(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
"Major mode for gdb inferior-io."
:syntax-table nil :abbrev-table nil
;; We want to use comint because it has various nifty and familiar
;; features. We don't need a process, but comint wants one, so create
;; a dummy one.
(make-comint-in-buffer
"gdb-inferior" (current-buffer) "sleep" nil "1000000000"))
and then set the terminal for program IO in GDB:
(gdb-input
;; Needs GDB 6.4 onwards
(list
(concat "-inferior-tty-set "
(process-tty-name (get-process "gdb-inferior")) "\n")
'ignore))
but it seems a bit of a hack
> I guess it would be convenient indeed to be able to use nil for the
> program rather than a contraption like the one above. OTOH we could
> just use `hexl' by adding a flag to it (it's already abused in a similar
> way by `ielm').
Could ielm use a buffer like the one I'm proposing?
> BTW in your patch I do not understand where the create_pty code comes
> from. It seems to come from Emacs code, in which case it is code
> duplication and should be avoided.
It's almost the first half of create_process. Sure it would make sense to
reuse code once it has been agreed that the function is useful.
--
Nick http://www.inet.net.nz/~nickrob