Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

1.9.0: the new automatic TTY detection breaks scripts #118

Closed
ewjoachim opened this issue Mar 11, 2020 · 4 comments
Closed

1.9.0: the new automatic TTY detection breaks scripts #118

ewjoachim opened this issue Mar 11, 2020 · 4 comments

Comments

@ewjoachim
Copy link

ewjoachim commented Mar 11, 2020

My script has the following function:

export_bw_session(){
        bw login --check || export BW_SESSION="$(bw login --raw)"
        bw unlock --check || export BW_SESSION="$(bw unlock --raw)"
        bw sync
}

This worked prior to 1.9.0. After upgrading, it stopped working: bw login --raw and bw login --raw now won't interactively ask for login/password

If we take the unlock case, I'd say it's because this line:
https://github.com/bitwarden/cli/blame/e7450d27e468f0e68fe5b75f9c52ffa952185484/src/commands/unlock.command.ts#L18

I would guess the problem is that unlock needs to disable reading from stdin if stdin is not a tty, but as of today, it's based on whether stdout is a tty or not.

Can you confirm ? Am I doing it wrong ? What should be the correct way to use --raw if not in BW_SESSION="$(bw login --raw)" ?

@ghost
Copy link

ghost commented Mar 12, 2020

Yep. This also broke my bash wrapper. Any possible workaround ?

@ewjoachim
Copy link
Author

ewjoachim commented Mar 12, 2020

Adding: The interactive test should probably be based on stdin and stderr. But not stdout.

@kspearrin
Copy link
Member

I have updated the next hotfix to only skip interaction if --nointeraction flag is passed in.

@kspearrin kspearrin reopened this Mar 12, 2020
@ewjoachim
Copy link
Author

Nice, thanks !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants