yamlfixer icon indicating copy to clipboard operation
yamlfixer copied to clipboard

Yamlfixer hangs on Git bash

Open adriens opened this issue 4 years ago • 19 comments

image

adriens avatar Mar 17 '22 02:03 adriens

Looks like a bug in git bash for me. If yamlfixer hangs its probably because it tries to read input from stdin, and it only does this if :

  • either - is specified as a filename on the command line, which is not the case here
  • or stdin is not a TTY, i.e. stdin is a pipe, which should not be the case here, unless git bash is broken.

tamere-allo-peter avatar Mar 17 '22 02:03 tamere-allo-peter

@adriens : if pressing Ctrl+D cleanly interrupts yamlfixer's hanging, see case 2 above.

tamere-allo-peter avatar Mar 17 '22 03:03 tamere-allo-peter

if pressing Ctrl+D cleanly interrupts yamlfixer's hanging, see case 2 above.

It does not interrupt, even not ^C

adriens avatar Mar 17 '22 03:03 adriens

Strange... Could you launch again with --debug then ?

tamere-allo-peter avatar Mar 17 '22 03:03 tamere-allo-peter

image

adriens avatar Mar 17 '22 03:03 adriens

That's what I said : you shell is buggy. In the code there's this :

# Ensure we read from stdin in case it's redirected
if ("-" not in sys.argv[1:]) and not sys.stdin.isatty():
    sys.argv.append("-")

This condition should not be met, but it is, hence there's probably a bug in your shell.

tamere-allo-peter avatar Mar 17 '22 03:03 tamere-allo-peter

@adriens could you paste the result of this on your git bash shell :

jerome@OPT17844:~$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdin.isatty()
True
>>> 

tamere-allo-peter avatar Mar 17 '22 03:03 tamere-allo-peter

I'll provide yo uthat this afternoon 👍

adriens avatar Mar 17 '22 04:03 adriens

image

adriens avatar Mar 17 '22 04:03 adriens

This sucks...

tamere-allo-peter avatar Mar 17 '22 04:03 tamere-allo-peter

Sure 💩 💋

adriens avatar Mar 17 '22 04:03 adriens

Big time !

tamere-allo-peter avatar Mar 17 '22 04:03 tamere-allo-peter

Legendary 💣

adriens avatar Mar 17 '22 05:03 adriens

@adriens Not a bug in yamlfixer for sure, please see https://github.com/git-for-windows/git/issues/2594

I'll keep this one open though, because there's a similar issue when run from a GitHub action and I'm working on this atm.

tamere-allo-peter avatar Mar 24 '22 00:03 tamere-allo-peter

@adriens here's a workaround for you : https://jpcodeqa.com/q/37d31f92ab77ec9de6be7e217da60985

tamere-allo-peter avatar Mar 24 '22 00:03 tamere-allo-peter

there's a similar issue when run from a GitHub action and I'm working on this atm.

in a way that's a good news you could reproduce it 🤞

adriens avatar Mar 24 '22 03:03 adriens

@mbarre pour Dockerfile, les variables à positionner

cf ~/yamlfixer/blob/main/yamlfixer/__main__.py

  and not os.environ.get("GITHUB_ACTIONS")
  and not os.environ.get("CI"):

exposer les variables dans Dockerfile et les positionner à true

adriens avatar Mar 24 '22 03:03 adriens

Yep, je viens d'ajouter GITHUB_ACTIONS, publication de l'image docker en cours

mbarre avatar Mar 24 '22 03:03 mbarre

cf https://github.com/opt-nc/yamlfixer/blob/99420745922981c9a7403e22de88cddbcfd58f6f/yamlfixer/main.py#L48

adriens avatar Mar 24 '22 03:03 adriens