Skip to content

How to use the Pipes for a cli cmd confirmation #66

Closed

Description

@utx0

Am new to this package, and am trying to use this for the underlying mechanics of a testing framework for a cli I am building.

Currently I have this function.

func CreatePool(fromUser,sourceChain,symbol,ticker, nativeAmount,externalAmount string) {
	cmd := fmt.Sprintf("sifnodecli tx clp create-pool --from %v --sourceChain %v --symbol %v --ticker %v --nativeAmount %v --externalAmount %v", fromUser,sourceChain,symbol,ticker, nativeAmount,externalAmount )
	p := script.Exec(cmd)
	p.SetError(nil)
	output, err := p.String()
	if err != nil {
		Fail(err.Error())
	}
	fmt.Println(output)
}

However the issue I am having with this cmd is it then requires an input confirmation before executing and the above cancels the cmd. ie

confirm transaction before signing and broadcasting [y/N]: 

Are you able to tell me how I would also automatically pass a Y to said cmd?

Thanks

Activity

  1. bitfield commented on Oct 20, 2020

    @bitfield
    Owner

    Yes, that's a tricky one! Perhaps we need something like ExecWithInput() that takes a command and a string to feed to its standard input?

  2. bitfield commented on Oct 20, 2020

    @bitfield
    Owner

    (On Linux or Mac, you can trivially pipe the command yes to programs like this to give them an affirmative response.)

  3. utx0 commented on Oct 20, 2020

    @utx0
    Author

    yeah in bash land I would just do

    yes Y | sifnodecli tx clp create-pool ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions