From: Oleksandr Gavenko <gavenko@bifit.com.ua>
To: help-gnu-emacs@gnu.org
Subject: Debug technique for comint, need stdin/stdout logger.
Date: Wed, 07 Sep 2011 17:32:53 +0300 [thread overview]
Message-ID: <j47vak$do7$1@dough.gmane.org> (raw)
When work with Emacs comint I need logger for stdin/stdout process
interaction.
So I change name of calling program in Emacs
and that logger/script call original command and log
stdin and stdout to files.
I try write expect script:
#!/usr/bin/env expect
set in [open in.log w]
set out [open out.log w]
log_user 0
spawn sort
set proc_id $spawn_id
stty -echo
expect {
-i $user_spawn_id -re . {
puts -nonewline $in $expect_out(buffer)
send -i $proc_id $expect_out(buffer)
exp_continue
} eof { }
-i $proc_id -re . {
puts -nonewline $out $expect_out(buffer)
send_user $expect_out(buffer)
exp_continue
} eof { }
}
expect -i $proc_id -re . {
puts -nonewline $out $expect_out(buffer)
send_user $expect_out(buffer)
exp_continue
} eof { }
close $in
close $out
but this is my first serious Expect script and it works bad:
$ printf 'b\nquit\na\n' | ./logger.exp; \
printf '\n===in===\n'; cat in.log; \
printf '\n===out===\n'; cat out.log
b
quit
a
C-c C-c # I type C-c
===in===
b
quit
a
===out===
b
quit # Why not sorted???
a
Are there any program that do this job or please help fix this script.
next reply other threads:[~2011-09-07 14:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 14:32 Oleksandr Gavenko [this message]
2011-09-21 22:12 ` Debug technique for comint, need stdin/stdout logger Oleksandr Gavenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='j47vak$do7$1@dough.gmane.org' \
--to=gavenko@bifit.com.ua \
--cc=help-gnu-emacs@gnu.org \
/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 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.