[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debug technique for comint, need stdin/stdout logger.
From: |
Oleksandr Gavenko |
Subject: |
Re: Debug technique for comint, need stdin/stdout logger. |
Date: |
Thu, 22 Sep 2011 01:12:55 +0300 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 |
07.09.2011 17:32, Oleksandr Gavenko пишет:
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:
...
I get working one.
It is used to debug interaction with Cygwin Python in 'python-mode'.
Expect come with all Linuxes and available under Cygwin...
#!/usr/bin/env expect
set in [open logger_in.log w]
set out [open logger_out.log w]
set timeout 3600
log_user 0
set stty_init {-echo}
# exp_internal 1
set cli [open logger_cli.log w]
foreach arg "$argv" {
puts $cli $arg
}
close $cli
eval spawn python2.6.exe $argv
set proc_id $spawn_id
expect {
-i $user_spawn_id -re (.+)\r?\n {
puts -nonewline $in $expect_out(buffer)
send -i $proc_id $expect_out(1,string)\n
exp_continue
} eof {
send -i $proc_id \x04
sleep 1
send -i $proc_id \x04
expect -i $proc_id -re .+ {
puts -nonewline $out $expect_out(buffer)
send_user $expect_out(buffer)
exp_continue
} eof { }
} -i $proc_id -re .+ {
puts -nonewline $out $expect_out(buffer)
send_user $expect_out(buffer)
exp_continue
} eof { }
}
close $in
close $out
wait