Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Handle standard streams redirection #51

Merged
merged 14 commits into from
Sep 19, 2020
Merged

Handle standard streams redirection #51

merged 14 commits into from
Sep 19, 2020

Conversation

0x2c7
Copy link
Owner

@0x2c7 0x2c7 commented Sep 19, 2020

There are some issues that mention Jard doesn't work well with foreman, pumactl, and similar apps redirect the standard stream. In addition, it doesn't work well with piping as well. This PR is to handle such cases by detecting real user's tty in case STDIN/STDOUT are not tty.

asciicast

Some tested and covered in tests:

  • Pipe stdin and stdout (covered in tests)
  • Redirect stdin and stdout (covered in tests)
  • Foreman (tested manually)

TODO in later PRs:

  • What if Jard runs inside docker?
  • What if Jard starts in an isolated process group, and doesn't have TTY at all?

Related issues:

@nonnenmacher
Copy link

so good, works like charm.

I patched a line in the puma.rb file that is read by pumactl launcher if present.

around redirection just don't redirect stdout (by passing a nil)

stdout_redirect nil, './log/error.log', true

And it works perfectly.

As this is the recommended way for a Docker deployment, it should work (not tested yet).

But at least it allow a pretty decent experience, on a production machine as last ressort.
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

Successfully merging this pull request may close these issues.

2 participants