Nathaniel Smith wrote:
On Fri, Oct 14, 2005 at 11:03:13PM +0200, Wim Oudshoorn wrote:
Not sure what is wrong, but the following monotone command gives me
troubles:
monotone cert 2c4 test-cert-1
It shows on the terminal
monotone: expanded selector '2c4' -> 'i:2c4'
monotone: expanding selection '2c4'
monotone: expanded to '2c4681f8bef0783c5cb0e1be092fc93e58907dd4'
*
With the cursor shown at the * location.
If I press enter I the screen looks like:
monotone: expanded selector '2c4' -> 'i:2c4'
monotone: expanding selection '2c4'
monotone: expanded to '2c4681f8bef0783c5cb0e1be092fc93e58907dd4'
enter passphrase for key ID [EMAIL PROTECTED]:
monotone: empty passphrase not allowed
enter passphrase for key ID [EMAIL PROTECTED]:
monotone: empty passphrase not allowed
enter passphrase for key ID [EMAIL PROTECTED]:
monotone: empty passphrase not allowed
monotone: misuse: no passphrase given
nelly:~/src/em-a woudshoo$
Just looked at this again. It seems to be a small, funky bug in
monotone.
If you pass only 2 arguments to 'cert', it reads stdin to get the
actual contents of the cert. It's not waiting for your password; it's
waiting for stdin to report end-of-file (e.g., by you pressing ^D).
However, I guess using 'cin' to read the contents of stdin is a bit of
a problem, since I think istreams will never become valid to read
after they have reported EOF, but the actual semantics of a tty
are that it _can_ become readable again after reporting EOF? I'm not
quite sure what should be done here; even if we fix the problem so you
can hit ^D and then enter your passphrase, a stdin-slurping interface
that can only be used effectively when stdin is a tty is sort of
pointless...
You can keep reading from an istream after an eof. The attached sample
program demonstrates this. This is the meat of it all:
cin.clear()
cin >> data
You can also check for an EOF by doing cin.eof().
> [...]
--
Matthew A. Nicholson
Matt-Land.com
// cin EOF test
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
char c;
while(cin >> c)
cout << c;
cout << "Checking for EOF\n";
if(cin.eof())
{
cout << "Got EOF, continuing anyway\n";
cin.clear();
while(cin >> c)
cout << c;
}
else
{
cout << "Reading failed for another reason, exiting\n";
}
return 0;
}
_______________________________________________
Monotone-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monotone-devel