edc / bass

Make Bash utilities usable in Fish shell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Close Failed in File Object Destructor

bbatsche opened this issue · comments

I'm getting the following error when trying to use bass to run some nvm commands:

The command:

bass source $NVM_DIR/nvm.sh --no-use ';' nvm use --lts --delete-prefix
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
unknown error: Unterminated string starting at: line 1 column 791 (char 790)
Traceback (most recent call last):
  File "/Users/bbatsche/.config/fish/functions/__bass.py", line 82, in <module>
    script = gen_script()
  File "/Users/bbatsche/.config/fish/functions/__bass.py", line 43, in gen_script
    new_env = json.loads(new_env)
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Unterminated string starting at: line 1 column 791 (char 790)
Bass encountered an error!

What's weird is that some other (less useful) nvm commands are still working. If I do bass source $NVM_DIR/nvm.sh --no-use ';' nvm ls I get the expected output.

  • fish --version
    • fish, version 2.4.0
  • python --version
    • Python 2.7.12

Doing some quick and dirty debugging, it looks like the nvm use --lts --delete-prefix is taking too long to complete. Dumping out new_env on repeated calls is giving me incomplete output of varying length, so the parent process isn't receiving all of the output from the env_reader command and ultimately is getting malformed JSON.

This should be fixed. I am closing this. Please reopen if it is still broken.