stopping xargs early (intermediate) anthony explains

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • today we talk about a debugging technique using xargs -- and making it stop on the first failure
    - xargs: • all about xargs ! (beg...
    playlist: • anthony explains
    ==========
    twitch: / anthonywritescode
    dicsord: / discord
    twitter: / codewithanthony
    github: github.com/aso...
    stream github: github.com/ant...
    I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!

Komentáře • 10

  • @POINTS2
    @POINTS2 Před 11 měsíci +5

    pytest has an option to stop on the first failure: "pytest -x". However, I can see where being able to do this from a text file is useful. Like the example, when a test is depending on the state set by a previous test.

    • @anthonywritescode
      @anthonywritescode  Před 11 měsíci +21

      in particular I was hunting for tests that failed on their own so --maxfail wasn't helpful (I'm a pytest core dev)

    • @fire17102
      @fire17102 Před 11 měsíci +2

      That little comment at the end got me ❤😂

  • @richardvdoost
    @richardvdoost Před 11 měsíci +1

    Interesting :) I should remember to use xargs more. I tend to use loops for this type of stuff.
    In this case a for loop might be easy to break out of on a failing test though. Something like this:
    for test in `pytest --collect-only -q`; do pytest -qq $test || break; done
    Only chokes on the garbage at the bottom but then it's done testing anyways.

  • @mrswats
    @mrswats Před 11 měsíci +1

    That's a good thing to know!

  • @sillybuttons925
    @sillybuttons925 Před 11 měsíci +1

    This is a great little trick

  • @jimigrok
    @jimigrok Před 11 měsíci

    very useful - thanks !

  • @Quarky_
    @Quarky_ Před 11 měsíci

    Very cool! Didn't know thanks :)

  • @sillybuttons925
    @sillybuttons925 Před 11 měsíci

    Hello!

  • @ruroruro
    @ruroruro Před 11 měsíci +1

    Wow, that sucks. Why is xargs ignoring all other failing error codes by default? Why is xargs treating 255 in any special way? Why is there no way to configure which exit codes result in which behaviour? Things like these is why I hate (ba)sh with a passion.
    I swear, if bash didn't have a monopoly on the "scripting language available out of the box on any *nix system" market, nobody sane would actually use this dumpster fire of a language/environment. The "Unix philosophy" is so focused on "do one thing" that they forgot to "do it well".