Repository: conan-io/conan

Issue:
Non interactive mode also prevents prompt from `conan user`
The new non interactive mode also prevents the prompt from `conan user <name> -p`. This is not what is specified in the documentation. (And also not what was originally implemented.)

I hope the prompt can be re-enabled for this particular case. If not, the documentation should be changed.

Oh, and a purely cosmetic remark: the non interactive error only appears after the prompt has been displayed.

Using Conan 1.2 on Windows 7.

- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.




Discussion:
Sorry for not notifying you the change, I forgot to write you. I changed it because for me it makes more sense to control it globally. And typically in a CI environment or an automated script you want to avoid any interactive input.
So yes, the docs have to be changed.

Could you point where is wrong the docs? I can't find it.
Thanks!
At http://docs.conan.io/en/latest/reference/env_vars.html#conan-non-interactive it says: 

> Invocations of conan user are not affected.

That's not true.


Docs fixed. Many thanks.
@lewie-donckers 

That is an interesting point, I didn't realize initially either. But it is true, that the original "pain" that this feature was trying to solve is CI jobs that were blocked because they were waiting for some user feedback. In this case, it is also possible that some ``conan user -p`` or eventually some other command that requires user input slips in the CI job, so I kind of like that no-interactive applies to all commands, and you will be sure that nothing blocks a CI job.
Yes, the new name and implementation do make more sense.

It's just that I would like a way to enter my password interactively on my machine even though I will have the non-interactive mode enabled. But a simple Python script can easily take care of that. :-)

That just leaves a minor cosmetic issue: the non-interactive error only appears after the prompt has been displayed. Nothing major, just a bit ugly imho.

```
$ conan user -p
Remote 'test' username: ERROR: Conan interactive mode disabled
```
I think you could also try (non-windows):
```bash
$ CONAN_NON_INTERACTIVE=0  conan user -p
```
As the env-var has precedence over the conan.conf, you would keep the non-interactive for the rest of operations.

Lets have a look to the prompt issue, and check if it has an easy fix.

Resolving patch:
diff --git a/conans/client/userio.py b/conans/client/userio.py
--- a/conans/client/userio.py
+++ b/conans/client/userio.py
@@ -40,6 +40,7 @@ def get_pass(self):
     def request_login(self, remote_name, username=None):
         """Request user to input their name and password
         :param username If username is specified it only request password"""
+        self._raise_if_non_interactive()
         user_input = ''
         while not username:
             try:


Test patch:
diff --git a/conans/test/command/user_test.py b/conans/test/command/user_test.py
--- a/conans/test/command/user_test.py
+++ b/conans/test/command/user_test.py
@@ -158,5 +158,10 @@ def test_command_user_with_interactive_password_login_prompt_disabled(self):
         error = conan.run('user -p -r default lasote', ignore_error=True)
         self.assertTrue(error)
         self.assertIn('ERROR: Conan interactive mode disabled', conan.user_io.out)
+        self.assertNotIn("Please enter a password for \"lasote\" account:", conan.out)
         conan.run("user")
         self.assertIn("Current 'default' user: None", conan.user_io.out)
+        error = conan.run("user -p", ignore_error=True)
+        self.assertTrue(error)
+        self.assertIn('ERROR: Conan interactive mode disabled', conan.out)
+        self.assertNotIn("Remote 'default' username:", conan.out)