Opening an editor for interactive use

W

Webb

Hi all,

(I am sure there is a recipe somewhere, but I can't find it.) How does
one open an editor while in the middle of an interactive program, let
the user do some editing and closing, and then capture the text that
was edited? I am reminded of subversion or CVS when they open an
$EDITOR session for the check-in log entry.

I tried os.popen, but it fired off vim in the background--not useful.
Then I tried os.system, but that only returns the return code (126 in
my case) after you close the editor. Perhaps I need to write to a file
and read it--shouldn't there be a cleaner way?

Thanks
W
 
F

Fredrik Lundh

Webb said:
(I am sure there is a recipe somewhere, but I can't find it.) How does
one open an editor while in the middle of an interactive program, let
the user do some editing and closing, and then capture the text that
was edited? I am reminded of subversion or CVS when they open an
$EDITOR session for the check-in log entry.

I tried os.popen, but it fired off vim in the background--not useful.
Then I tried os.system, but that only returns the return code (126 in
my case) after you close the editor. Perhaps I need to write to a file
and read it

that's exactly how it's done in subversion and cvs, of course.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top