[svk-devel] [PATCH] don't mess with /dev/tty, it's not ours
Vincent Legoll
vincent.legoll at gmail.com
Sun Apr 26 10:34:32 EDT 2009
Hello,
I wanted to automate some svk use from a script, but found that
even `svk info` is interactive (asking to create a local repo)
I tried to overcome the problem with:
echo n | svk info
but that won't work properly, neither did `expect`, BTW.
And add that when doing the above `echo n | svk info` the tty
was messed with and left in a bad state: local echo was disabled
and has to be restored manually with `stty sane`. :-(
Then I though something should already exist to avoid that user
interaction, and after some search found the following bug report:
#28091: Please consider adding support for non interactive usage.
I looked at the code and found the "I'm not given a tty as stdin,
let's use /dev/tty" gem (ruby pun intended) in Util.pm::get_prompt().
If you're not given a "real" tty, maybe that's just what the user
wants, don't try to be smarter, please.
The attached patch remove that code, and allows one to do:
echo n | svk info /tmp/this/is/not/a/svk/repo
And still have a tty in a good shape afterwards.
Ok, this is still a workaround for that there's no command line
option to disallow svk from creating a local repository when
all we want to know if some directory is a working copy.
Maybe the real fix would be not to ask for a local repo creation
from SVK::Command::Info, and just return the "%1 is not a
checkout path" mantra
What do you think ?
--
Vincent Legoll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dont-mess-with-dev-tty-its-not-ours.patch
Type: text/x-diff
Size: 581 bytes
Desc: not available
Url : http://lists.bestpractical.com/pipermail/svk-devel/attachments/20090426/01d5b1a0/attachment.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: whitespace-cleanup.patch
Type: text/x-diff
Size: 313 bytes
Desc: not available
Url : http://lists.bestpractical.com/pipermail/svk-devel/attachments/20090426/01d5b1a0/attachment-0001.patch
More information about the svk-devel
mailing list