Closed hboon closed 1 week ago
Does node_modules/.bin/ts-node src/index.ts
take user input from keyboard?
fzf crashes
Are there any error messages?
Does node_modules/.bin/ts-node src/index.ts take user input from keyboard?
No.
Are there any error messages?
No. So, at a loss what to do to debug. I could run the GitHub version again if there's a way to enable logging somewhere.
Can you provide minimal steps to reproduce the problem from my side? I don't have your project with index.ts so there's no way I can further look into the problem. Also, please don't assume that I know anything about the thing called "ts-node".
Ah, sorry, I was hoping to look for a way to get debug logs so I can gather more information first. Thanks for helping to look into this.
I was wrong, it wasn't ts-node
, but nodemon which reproduces the issue. From the tool's README:
Monitor for any changes in your node.js application and automatically restart the server - perfect for development
I made a repo to reproduce the issue for me — https://github.com/hboon/nodemon-fzf/. It's really just running nodemon
or a single source file that logs 1 line to STDOUT. There are 2 branches. (B) should be easier to get started (but trust…).
A. main
— you will need to have pnpm
installed and run pnpm i
first to install the nodemon
that is causing this)
B. with-node-modules
— this includes nodemon
already so you can skip (A), and don't need to install pnpm
Run this:
node_modules/nodemon/bin/nodemon.js index.js | fzf
index.js
only logs a line to STDOUT so I suppose it's the way nodemon
works that's causing an issue?
I'm hoping to use fzf
for streaming server logs during development.
Thanks for the repro. I can reproduce the problem, and it definitely looks like nodemon
is trying to read user input. So nodemon
and fzf
are both competing to read from /dev/tty
at the same time, and it causes the problems.
By redirecting /dev/null
to its standard input.
node_modules/nodemon/bin/nodemon.js index.js < /dev/null | fzf --ansi --tail 10000 --tac
The problem is nodemon
doesn't terminate after fzf exits.
fzf --ansi --tail 10000 --tac --bind 'start:reload:node_modules/nodemon/bin/nodemon.js index.js'
fzf starts nodemon process when it starts, and can terminate it when it exits.
(Works better with https://github.com/junegunn/fzf/commit/5b5283378571cca88a993630db3307319d2cb56d)
Both workarounds work for me. I'll use (2). Doesn't seem like 5b52833 is needed yet.
But all good. Thanks again!
Checklist
man fzf
)Output of
fzf --version
0.53.0 (brew)
OS
Shell
Problem / Steps to reproduce
I can reproduce with the latest on github too. fish and bash.
If I do:
I noticed that filtering by typing seems to be extremely slow, given the number of lines (and compared to running
fzf
with other cases on the same machine in the same shell).I'm not sure what's going on, but is there a way to enable some logs so I can gather more information?