dahlia / iterfzf

Pythonic interface to fzf, a CLI fuzzy finder
https://pypi.python.org/pypi/iterfzf
GNU General Public License v3.0
164 stars 19 forks source link

Python crashes when result is too long #9

Open oerpli opened 4 years ago

oerpli commented 4 years ago

iterfzf seems to crash, when multi=True and a lot of long-ish lines are selected.

Just thought I'd open an issue, I may look into it in the next days and will open a PR if I find a fix.

Here's a snippet to test whether it "works on your system"

import iterfzf as fzf

line_length =  int(input("Input line length: ")) # use something between 50 and 100 
lines = [str(i) + '+'* line_length for i in range(200)]

fzf.iterfzf(lines, multi=True) # select ~100 elements

I have glanced at the implementation but didn't find any obvious issue, though I am no expert with subprocess.

dahlia commented 4 years ago

Hmm… your code does not reproduce the bug in both CPython 2.7.15 and 3.7.4 on macOS. What's your OS and Python version?

oerpli commented 4 years ago

Oh sorry for leaving out that information. It was with Win10 and Python 3.7.4 and 3.8.2.

dahlia commented 4 years ago

As I currently have no Windows box, it's difficult to reproduce this bug for me. 😥 It would be great if you send a patch to fix this.

oerpli commented 4 years ago

I am currently working on it. Btw - would you be okay if I refactored the code in __init__.py while I'm at it? I found it a bit unidiomatic.

dahlia commented 4 years ago

If diffs become longer it would be harder to review for me… Some touches on style would be fine though.