chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Scraping the REPL?


From: Matt Welland
Subject: Re: [Chicken-users] Scraping the REPL?
Date: Sat, 23 Jan 2016 21:41:39 -0700

Unless you need it's ability to capture all input you might be able to get away without using script and just use simple scripting:

address@hidden:/mfs/matt/nodemcu/esptool$ (csi -q<< EOF
(define (f x)(+ x 123))
(f 8)
EOF
 ) > example1.txt

address@hidden:/mfs/matt/nodemcu/esptool$ cat example1.txt
csi> (define (f x)(+ x 123))
csi> (f 8) 131
csi>


On Sat, Jan 23, 2016 at 3:39 PM, Matt Gushee <address@hidden> wrote:
Hi, James--

On Sat, Jan 23, 2016 at 10:51 AM, Hefferon, James S. <address@hidden> wrote:

Thank you for the "script" suggestion.  I apologize but I don't understand it.

​I see the problem. I had forgotten that csi has a -script option. I meant something entirely different - the 'script' command, which is entirely independent of Chicken Scheme​, and is available on most if not all POSIX systems. You use it like this:

$ script /path/to/transcript.file           # You are now in a subshell
$ csi
#;1>
[ doing whatever in Chicken ]
#;N> (exit)                                      ; exit from REPL
$ exit                                             # exit from subshell

You will now have a complete transcript of your csi session, including all the prompts, everything you entered, and all the output. I mentioned that you will probably need to edit the result. That's because script captures raw keystrokes - e.g. if you type

   (defin foo 21)

and you see you misspelled 'define', and correct it, what you get in your transcript will be not

   (define foo 21)

but rather

   (defin foo 21)^H^H
^H^H
^H^H
^H^H
e foo 21)

script also, for some reason, adds a carriage return at the end of every line, which you may not want. There is apparently no way to change that behavior. But it does capture your entire session.

​Hope your project goes well.​


_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]