-
-
Notifications
You must be signed in to change notification settings - Fork 339
Closed
Description
Hello, and thank you for this wonderful package!
I'd like to use script
with some programs that use standard error to prompt the user to do something before providing output. One example is ykman
which prompts the user to "Touch your YubiKey...". After doing so, the program will print the one time password code to standard out. Ideally, I'd like the program's standard error to pass-through directly to os.Stderr, but it appears that script.Exec()
instead interleaves the program's stderr and stdout. This means the user of this script doesn't receive the prompt from the program, and also means the prompt needs to be filtered out of the output. I'm curious if anyone has come up with a way to handle this. Below is a minimal example. Thanks!
package main
import (
"github.com/bitfield/script"
)
func main() {
p := script.Exec(`
ykman oath accounts code --single "someAccountId"
`)
code, _ := p.String()
script.Echo(code).Stdout()
}
Metadata
Metadata
Assignees
Labels
No labels