Skip to content
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

Fix interactive UI for git push using password protected ssh key #393

Closed
wants to merge 2 commits into from

Conversation

matscube
Copy link
Contributor

Overview

This fix is related to Issue #369 .
When using password protected ssh key, password input is required when pushing with git push in the oco command, but there was a problem that the input could not be entered smoothly.
After confirming the operation, it seems that the password input UI is obstructed by the spinner. (It is not always input failure and there may be cases where you can enter it successfully)

Fix

Removed spinner.
It was judged that it is better not to sandwich the process that requires stdout/stdin with the user during command execution with spinner.

Behavior before and after the fix

  • Before the fix
before_revision.mov
  • After the fix
after_revision.mov

@di-sukharev
Copy link
Owner

@matscube so there is no way to keep the spinners?

@matscube
Copy link
Contributor Author

@di-sukharev
I haven't checked yet if there is a way to keep the spinner while fixing it.
I think the easiest way is to replace the spinner with text, but I don't think it's good to lower the quality of the UI.
I'll look into it a little more to see if there is a way to keep the spinner.

@di-sukharev
Copy link
Owner

please 🙏

@di-sukharev
Copy link
Owner

there was a big refactoring in #391, not much got conflicted, but there is one file

btw for the spinner, is there a way we can tell that spinner will break things, like in this case with ssh password? we could then not start it and fallback to outro("loading") in this particular case

@matscube
Copy link
Contributor Author

@di-sukharev

btw for the spinner, is there a way we can tell that spinner will break things, like in this case with ssh password? we could then not start it and fallback to outro("loading") in this particular case

If a child process is executed between spinner's start() and stop() methods, a problem like this is likely to occur. (For example, when executing a command using the execa library)

If the processing between start() and stop() is just a js processing, interactive input and output will not be executed, so it should work fine.

@di-sukharev
Copy link
Owner

@matscube

i see, so there is no way we know if the stdout gonna be interactive or not and thus we cant keep the spinner?

@matscube
Copy link
Contributor Author

@di-sukharev

I can't say for sure without looking closely at the specifications of Node.js stdin/stdout and the implementation of execa and @clack/prompts libraries.

If the following technical hurdles can be overcome, it will be possible to achieve both spinner and input UI.

  • Detecting standard input from child processes in Node.js
  • Filtering specific stdout (such as messages prompting for password input) during command execution via execa and inserting arbitrary processing

I plan to investigate when I have time.

@di-sukharev
Copy link
Owner

di-sukharev commented Aug 29, 2024 via email

@matscube
Copy link
Contributor Author

@di-sukharev
I don't think it's common to use a password-protected ssh key for git push.
Also, there are workarounds like setting OCO_GITPUSH to false or caching the password with ssh-add.
I'm not sure how long it will take to fix this problem cleanly, so for now, it seems better to leave it as a spinner as you suggest.
I'm going to close this PR for now, is that okay?

@di-sukharev
Copy link
Owner

@matscube lets close it, yep

@matscube matscube closed this Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants