yhirose / vscode-filtertext

Filter Text extension for VS Code
MIT License
30 stars 9 forks source link

A bug fix and better error reporting #11

Closed johnnytemp closed 6 years ago

johnnytemp commented 6 years ago
  1. A bug fix: when filter on empty document -> child process never ends.
  2. Better error reporting: In case command have explicit error messages (on stderr) and exited with failure status, and nothing output in stdout --> don't change text selection but pop an error message instead. (grep command with no match will still be treated as success, although it return a failure status)

The second change can help to know why a command fail.

I think these changes improve the plugin. Thanks.

yhirose commented 6 years ago

@johnnytemp, thanks for another contribution! I tried to reproduce the first problem (when filter on empty document -> child process never ends) on my MacBook, but I couldn't. Could you give me more detail about it? Thanks!

johnnytemp commented 6 years ago

Thank you yhirose. I reproduce like this on Windows (At work, I have mac and seems I have tested with same behavior IIRC, but I can confirm you if you still cannot reproduce with this) :

  1. settings is "filterText.invokeViaBash.windows": false (default)
  2. File -> New file to create an empty document.
  3. Without any selection, invoke Filter Text Inplace, enter command: bash -c 'cat; echo done' Remark: I have bash.bat in PATH as wrapper to call C:\cygwin\bin\bash.exe
  4. "done" is never outputed. (within many seconds, over 20)
  5. Then, I perss Enter at the document to insert a newline, and retry step 3, the document successfully output "done" (within 4 seconds).

Note the command invoked must read stdin to reproduce.

Thanks.

yhirose commented 6 years ago

With the steps you mentioned, I was able to reproduce it on my MacBook! I updated version of the extension to 0.0.10. Thanks again for your great contribution!

johnnytemp commented 6 years ago

Thank you for your consideration. :-)