iterfzf icon indicating copy to clipboard operation
iterfzf copied to clipboard

Python crashes when result is too long

Open oerpli opened this issue 5 years ago • 5 comments

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.

oerpli avatar Feb 10 '20 15:02 oerpli

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?

dahlia avatar Feb 10 '20 20:02 dahlia

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

oerpli avatar Feb 10 '20 20:02 oerpli

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.

dahlia avatar Feb 10 '20 20:02 dahlia

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.

oerpli avatar Feb 10 '20 20:02 oerpli

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

dahlia avatar Feb 10 '20 20:02 dahlia