repo emitting control codes with no tty

10 views
Skip to first unread message

Don Garrett

unread,
Dec 17, 2014, 4:39:13 PM12/17/14
to Chromium OS dev, chromeos-infra-discuss
I'm finding that the 'repo' command is sometimes emitting terminal formatting codes, but not always. I need a clean way to either stop it, or strip them after the fact.

On my workstation, I see bold project names with:
 repo forall -p -c pwd

On my workstation, I do NOT see bold project names with:
 repo forall -p -c pwd | cat 

On an autotest lab server (and the autotest prod manifest), I see bold manifest names with both versions. The only relevant differences so far...

I'm running a local terminal on my workstation. I connected to the autotest server using 'become'. The python versions (2.7.6 locally, 2.7.3 remote) are different.

Mike Frysinger

unread,
Dec 17, 2014, 4:51:49 PM12/17/14
to Don Garrett, Chromium OS dev, chromeos-infra-discuss
reading the repo source:
~/chromiumos/.repo/repo/color.py:
class Coloring(object):
  def __init__(self, config, section_type):
    self._section = 'color.%s' % section_type
    self._config = config
    self._out = sys.stdout

    on = self._config.GetString(self._section)
    if on is None:
      on = self._config.GetString('color.ui')

    if on == 'auto':
      if pager.active or os.isatty(1):
        self._on = True
      else:
        self._on = False
    elif on in ('true', 'always'):
      self._on = True
    else:
      self._on = False

so set color.ui=no in ~/chromiumos/.repo/manifests/.git/config
-mike


--
You received this message because you are subscribed to the Google Groups "chromeos-infra-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-di...@google.com.
To post to this group, send email to chromeos-in...@google.com.
To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/chromeos-infra-discuss/CA%2B8%3DyoLpV0oeXmRg9WJUTW3qr_MMUKvJx1LUQPg33mrebJ1GWQ%40mail.gmail.com.

Don Garrett

unread,
Dec 18, 2014, 5:39:58 PM12/18/14
to Mike Frysinger, Chromium OS dev, chromeos-infra-discuss
And there is no way to do that as part of the repo command line? I don't want to add any thing new to the setup process for these servers, if I can help it.

Mike Frysinger

unread,
Dec 18, 2014, 6:11:31 PM12/18/14
to Don Garrett, Chromium OS dev, chromeos-infra-discuss
seems like it.  i'm only reading the source, not any docs.

this hack also seems to work:
  export HOME=$(mktemp -d)
  printf '[color]\nui = no\n' > "${HOME}/.gitconfig"
-mike

Don Garrett

unread,
Dec 18, 2014, 7:09:37 PM12/18/14
to Mike Frysinger, Chromium OS dev, chromeos-infra-discuss
Oh.... I didn't realize repo was reading .gitconfig from HOME. That's a lot easier to manage via puppet.

I've already build a hack based on stripping out the control codes via regexes. I may put that in, then work on a puppet config change to do it properly.

To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-discuss+unsub...@google.com.
To post to this group, send email to chromeos-infra-discuss@google.com.

--
You received this message because you are subscribed to the Google Groups "chromeos-infra-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-discuss+unsub...@google.com.
To post to this group, send email to chromeos-infra-discuss@google.com.

--
You received this message because you are subscribed to the Google Groups "chromeos-infra-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-discuss+unsub...@google.com.
To post to this group, send email to chromeos-infra-discuss@google.com.
--
You received this message because you are subscribed to the Google Groups "chromeos-infra-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-discuss+unsub...@google.com.
To post to this group, send email to chromeos-infra-discuss@google.com.
To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/chromeos-infra-discuss/CAAbOScnCrC5F2HZZ5fgkqHkL1LeGQYB0Y1jGyh1jETnvNYdY4w%40mail.gmail.com.

Mike Frysinger

unread,
Dec 18, 2014, 7:10:46 PM12/18/14
to Don Garrett, Chromium OS dev, chromeos-infra-discuss
it reads both -- the user's ~/.gitconfig and the repo-specific manifest so you can do per-repo overrides
-mike

To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-di...@google.com.
To post to this group, send email to chromeos-in...@google.com.
To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/chromeos-infra-discuss/CA%2B8%3Dyo%2BZ31wb1QM%3DGnoV8amQbx6z-c2_YKR3w4bjATfE7epkyQ%40mail.gmail.com.

Mike Frysinger

unread,
Dec 22, 2014, 3:23:41 PM12/22/14
to Don Garrett, Chromium OS dev, chromeos-infra-discuss

On Wed, Dec 17, 2014 at 4:39 PM, Don Garrett <dgar...@chromium.org> wrote:

--
You received this message because you are subscribed to the Google Groups "chromeos-infra-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-infra-di...@google.com.
To post to this group, send email to chromeos-in...@google.com.

Mike Frysinger

unread,
Feb 23, 2015, 8:48:34 PM2/23/15
to Don Garrett, Chromium OS dev, chromeos-infra-discuss
latest repo in our tree now has the `repo --color=never` option
-mike

Don Garrett

unread,
Feb 23, 2015, 8:51:59 PM2/23/15
to Mike Frysinger, Chromium OS dev, chromeos-infra-discuss
You rock!
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages