direnv: Messages show terminal control codes even when not connected to a terminal

I’m running direnv exec some_script from within a Jenkins pipeline. The pipeline logs show the following:

[mdirenv: loading ~/jenkins_slave/<long-path>/.envrc

Note the [m at the beginning of the message. I’m guessing this is a terminal control code.

I’m not sure how this could be easily reproduced. I tried redirecting stdout/stderr to a file, hoping to see the control code in the log file, but I can’t seem to be able to do it. Since the output file is not a terminal, this would have been a way to check the fix.

Since Jenkins logs (and logs in general) don’t support terminal control codes, they shouldn’t be printed.

Environment

  • OS: RHEL7
  • Shell: sh (started from bash 4.4.20)
  • Direnv version 2.32.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

It’s been a while isn’t it? Released v2.32.2: https://github.com/direnv/direnv/releases/tag/v2.32.2