Skip to content

Emoji in command output seems to break #781

@clemens

Description

@clemens

The latest release seems to have an issue when emojis (or more general: UTF-8 characters) are used in a command's output.

Here's the error i'm getting:

Checks for vulnerable versions of 3rd party packages.......[NpmAudit] FAILED
Hook raised unexpected error
"\xF0" on US-ASCII
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/subprocess.rb:105:in `convert'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/subprocess.rb:105:in `to_utf8'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/subprocess.rb:55:in `spawn'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/utils.rb:187:in `execute'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_context/base.rb:33:in `execute_hook'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_loader/plugin_hook_loader.rb:85:in `run'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook/base.rb:47:in `block in run_and_transform'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/utils.rb:260:in `with_environment'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook/base.rb:47:in `run_and_transform'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_runner.rb:162:in `run_hook'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_runner.rb:98:in `block in consume'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_runner.rb:94:in `loop'
/var/lib/gems/2.5.0/gems/overcommit-0.59.0/lib/overcommit/hook_runner.rb:94:in `consume'

The command looks like this:

NpmAudit:
  description: 'Checks for vulnerable versions of 3rd party packages'
  enabled: true
  command: ['bin/npm-audit']

The binary looks like this:

#!/bin/bash

$(npm bin)/better-npm-audit audit

The output from the command is this:

Screenshot 2022-04-29 at 11 52 56


I'm assuming this is related to #766.

OS: Debian 10 in Docker container
overcommit version: 0.59.0 (it works fine in 0.58.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions