docksal / addons

Community driven, submit your addon! Docksal addons that can be installed via `fin addon install` command.
MIT License
16 stars 34 forks source link

Codeclimate add-on: "the input device is not a TTY" #7

Closed nplowman closed 6 years ago

nplowman commented 6 years ago

When I attempt to run 'fin codeclimate' from a git hook, I get the following error: the input device is not a TTY

Considering that running code sniffers from a pre-commit hook is a pretty common use case, this is a pretty big issue.

It looks like if I remove the -tty option here, it resolves the issue:

docker run \
  --interactive --tty --rm \
  --env CODECLIMATE_CODE="$PROJECT_ROOT" \
  --volume "$PROJECT_ROOT":/code \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/cc:/tmp/cc \
  codeclimate/codeclimate $@

Is this something that can be safely removed so that it plays nicely with git hooks? Or possibly another work-around for this issue?

asgorobets commented 6 years ago

You can safely remove it, but you will lose colors in terminal when running without --tty. So ideally I would remove it conditionally using an extra parameter to the fin codeclimate command, like in fin codeclimate --no-tty

achekulaev commented 6 years ago

I guess it's better to steal is_tty function from fin

is_tty ()
{
    [[ "$(/usr/bin/tty || true)" != "not a tty" ]]
}

and use it conditionally to have that parameter or not.

Feel free to create a pull request. addons repository is very democratic.

nplowman commented 6 years ago

I put in a PR for review: https://github.com/docksal/addons/pull/8

achekulaev commented 6 years ago

Merged. Thanks!