-
Notifications
You must be signed in to change notification settings - Fork 192
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
Upgrade from 0.11 to 0.12 break support for interactive shells #305
Comments
Thanks for the bug report @kacperk! I'm working on envconsul now and will see what I can do about this. |
Seems related to #283 |
It looks like this one is caused by the use of setpgid for the command call that was added to ensure signal propagation in consul-template (hashicorp/consul-template@5717544). It was added due to the change to wrap many commands in 'sh -c [...]' and the setpgid was required to be sure the signals were propagated through that wrapping shell call to the underlying process. I'll look into ways to mitigate this issue. |
Initial idea is to revisit the setpgid logic in consul-template. It was added as a way to deal with migrating from a bad shell parsing library to just using 'sh -c' around the commands.. to be sure the signals to that wrapping sub-shell were propagated to the command called in it. So the idea is to restrict it to just that case.. if the command is 'sh' and the first arg is '-c' then setpgid, otherwise don't. Need to think on this a bit though. |
Found more on interactive sub-processes specifically. Here are 2 related stack overflow questions about setpgid breaking interactive commands on child processes. There is a go issue that deals with a bug in how this was implemented (and fixed). |
So I've gone down 2 paths. The first is based on the above. Changing the child call to take setpgid flag and only setting it when the command parser has detected a script like command and wrapped it with The other path checks that Std{in,out,err} is open and if so adds the These both fix the problem. I'm leaning toward the first case as it reduces the number of system flags/calls and should keep things working in a normal manner most of the time without the added overhead of what the side effects of I'm going to start working on the first option. Please chime in if you have any thoughts on this. Thanks! |
PR to consul-template with the require changes up for review. hashicorp/consul-template#1600 Once merged I'll bump up the envconsul dependency. |
The interactive shells stopped working after updating from 0.11 to 0.12. It works fine for previous versions (before 0.11).
We are using envcosnul to run ruby on rails console for doing some admin and maintenance work on different environments.
Until the update to version 0.12, it worked perfectly fine with envconsul. Version 0.12 breaks the support for any interactive shell - you can reproduce using
bash
commandEnvconsul version
0.12.1
Command
Running any interactive shell
Debug output
0.11.0
0.12.1
Expected behavior
Update to a newer version shouldn't break previous behaviour
Actual behavior
Interactive shell stoped working on update 0.11 -> 0.12
Steps to reproduce
envconsul -once -prefix elk --log-level=debug bash
- works fine (you can replace prefix with any other configuration)envconsul -once -prefix elk --log-level=debug bash
- bash doesn't work anymoreThe text was updated successfully, but these errors were encountered: