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

#39: Login error: standard input is not a terminal #8

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Ensure no TTY if user does not need to input anythin
on:
push:
workflow_dispatch:

jobs:
job1:
name: Login
runs-on: ubuntu-latest
env:
TOKEN_JSON: ${{ secrets.TOKEN_JSON }}
CREDENTIALS_JSON: ${{ secrets.CREDENTIALS_JSON }}
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Commands
run: |
echo
date
pwd
whoami
make all
ls -lah bin/launchr
./bin/launchr login --url=http://***.git --username="***" --password="***" --keyring-passphrase="***"
20 changes: 12 additions & 8 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ func buildNotFoundError(item, template string, err error) error {

func login(k Keyring, creds CredentialsItem) error {
// Ask for login elements if some elements are empty.
err := RequestCredentialsFromTty(&creds)
if err != nil {
return err
if creds.isEmpty() {
err := RequestCredentialsFromTty(&creds)
if err != nil {
return err
}
}

err = k.AddItem(creds)
err := k.AddItem(creds)
if err != nil {
return err
}
Expand All @@ -220,12 +222,14 @@ func login(k Keyring, creds CredentialsItem) error {

func saveKey(k Keyring, item KeyValueItem) error {
// Ask for login elements if some elements are empty.
err := RequestKeyValueFromTty(&item)
if err != nil {
return err
if item.isEmpty() {
err := RequestKeyValueFromTty(&item)
if err != nil {
return err
}
}

err = k.AddItem(item)
err := k.AddItem(item)
if err != nil {
return err
}
Expand Down
Loading