-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if TTY is invalid in encryption:encrypt-all and encryption:decrypt-all #10439
Check if TTY is invalid in encryption:encrypt-all and encryption:decrypt-all #10439
Conversation
@@ -123,6 +123,16 @@ protected function configure() { | |||
} | |||
|
|||
protected function execute(InputInterface $input, OutputInterface $output) { | |||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
windows is not supported anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I suggest we will do nothing if we deal with Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just remove this - that it breaks on windows is not a surprise, all of Nc breaks... Or should we keep it in @nickvergessen ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The official documentation doesn't suggest Windows as an option, so it would be fair enough to remove the Windows-related checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eugulixes go ahead, I suppose, if this was the only issue @nickvergessen had then it would suffice to get this ready to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
818379e
to
5cd4029
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good 👍 Tested and works
Failing unit tests |
5cd4029
to
cc40db2
Compare
Yeah, these built-in functions don't react well to phpunit (on CI?). I'd suggest to create a simple wrapper class for this that internally calls the php functions. This way we can mock them in unit tests. @eugulixes do you know how that works? I see this is your first contribution, so please let me know if you need assistance ✌️ That class would look something like namespace OCP\Console;
class Environment {
public function isInteractive(): bool {
return posix_isatty(STDOUT);
}
} Inspiration was taken from https://github.com/sebastianbergmann/environment/blob/32c5cba90f7db47b1c10a777b36eccfd44ef8bd7/src/Console.php#L78, so that might also be an option to integrate. I've found traces of that class in my local dev setup. |
You could use |
Ha! Didn't know it was that simple! Thank you 😄 |
@eugulixes ping :) |
@ChristophWurst, i'm planning to do it this weekend. |
Awesome, thanks! |
35dccff
to
2bfccdf
Compare
@ChristophWurst, I used |
You need to mock
I guess the same applies to
|
2bfccdf
to
4fcfe9a
Compare
…ypt-all Signed-off-by: Evgeny Golyshev <eugulixes@gmail.com>
4fcfe9a
to
ec2f02f
Compare
@ChristophWurst, @danielkesselberg, all tests passed. Thank you for your help. |
Inspired by #9894.
The commands
occ encryption:decrypt-all
andocc encryption:encrypt-all
transform into interactive processes since they both useConfirmationQuestion
. It's not possible to execute the commands in a container viadocker exec
without the-i
and-t
options. However, it becomes not obvious from a user point of view why since the result of both commands in this case isaborted
. This PR tries to solve the problem.Fixes #9894.
Signed-off-by: Evgeny Golyshev eugulixes@gmail.com