hharnisc / hypercwd

Opens new tabs with the same directory as the current tab in Hyper
MIT License
384 stars 39 forks source link

fix: Can't open new tab when current path contains multibyte characters #57

Open hoto17296 opened 6 years ago

hoto17296 commented 6 years ago

fixes #53

Problem

When current path contains multibyte characters, action to open new tab fails.

$ mkdir 日本語
$ cd 日本語

Cause

  1. LANG env is empty when the command is executed from child_process.exec.
  2. When LANG env is empty, the multibyte characters contained in the result of the lsof command are escaped.
    • e.g. /path/to/dir/日本語 -> /path/to/dir/\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e
  3. Due to No such directory error, SESSION_SET_CWD event fails.
  4. The action to open a new tab fails.

Solution

Specify LANG=en_US.UTF-8 when execute lsof command.

hoto17296 commented 5 years ago

@hharnisc Could you review this PR? I really want to fix #53