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

command/lock: Pass stdin to child process when -pass-stdin passed. #1200

Merged
merged 2 commits into from
Sep 1, 2015

Conversation

ryotarai
Copy link
Contributor

I added -pass-stdin option to pass stdin to a hander process.

$ echo foo | bin/consul lock bar cat

$ echo foo | bin/consul lock -pass-stdin bar cat
foo

Use case

I'd like to execute an arbitrary command via consul lock on events fired.

$ consul watch -type event -name foo \
  consul lock -pass-stdin bar cat
[{"ID":"4deac22a-7f00-5320-8de1-2ee5932f4599","Name":"foo","Payload":null,"NodeFilter":"","ServiceFilter":"","TagFilter":"","Version":1,"LTime":2}]

@ryotarai ryotarai changed the title command/lock: Pass stdin to child process when --pass-stdin passed. command/lock: Pass stdin to child process when -pass-stdin passed. Aug 26, 2015
@slackpad
Copy link
Contributor

Hi @ryotarai - code looks good. Can you please also update https://github.com/hashicorp/consul/blob/master/website/source/docs/commands/lock.html.markdown as part of this change?

@ryotarai
Copy link
Contributor Author

ryotarai commented Sep 1, 2015

Hi @slackpad
Thank you for reviewing. I updated the doc: ryotarai@b2755d0

slackpad added a commit that referenced this pull request Sep 1, 2015
command/lock: Pass stdin to child process when -pass-stdin passed.
@slackpad slackpad merged commit 26ce9d1 into hashicorp:master Sep 1, 2015
@ryotarai ryotarai deleted the lock-pass-stdin branch September 1, 2015 05:03
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