From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: emacs-devel@gnu.org
Subject: Re: Opening a pty without a process
Date: Tue, 27 Nov 2007 21:21:57 -0500 [thread overview]
Message-ID: <jwv4pf7m7pa.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <18252.42652.407333.68366@kahikatea.snap.net.nz> (Nick Roberts's message of "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
Yes, I guess `sleep' works as well.
>> 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?
No. It needs "cat" (and used to use "cat").
>> 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.
Please do that,
Stefan
next prev parent reply other threads:[~2007-11-28 2:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-05 20:46 Opening a pty without a process Nick Roberts
2007-11-26 20:27 ` Nick Roberts
2007-11-27 5:30 ` Richard Stallman
2007-11-27 6:09 ` Nick Roberts
2007-11-27 19:53 ` Richard Stallman
2007-11-27 23:23 ` Nick Roberts
2007-11-27 15:36 ` Stefan Monnier
2007-11-27 23:22 ` Nick Roberts
2007-11-28 2:21 ` Stefan Monnier [this message]
2007-11-28 4:16 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv4pf7m7pa.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=nickrob@snap.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).