Tuesday, July 12, 2016

git log exit code 141?

Something's that been bugging me for a while now is that when I do a `git log` command and quit before scrolling through all the output, my terminal prompt shows my last command (the git log) exited non-zero with status code 141.

I have git configured to use `less -+S` as the pager.

The answer turns out to be really straightforward, but took me a little bit of internet searching. I am capturing the learning here to save my future self the research and possibly anyone else typing the exact same thing into Google that I did ;-)

The explanation:

  • Git pipes the logs into less
  • I quit the less process, which sends a SIGPIPE signal (13) to the underlying git process streaming the logs
  • git catches the interrupt and exits prematurely and per POSIX convention returns 128 + the SIGPIPE status ==> 141 to indicate that it was terminated by signal 13
The background:
  1. http://stackoverflow.com/questions/19120263/why-exit-code-141-with-grep-q
  2. http://www.pixelbeat.org/programming/sigpipe_handling.html
  3. http://unix.stackexchange.com/questions/99112/default-exit-code-when-process-is-terminated/99134#99134

46 comments:

  1. Is there any way to fix the exit code so that it is 0?

    ReplyDelete
    Replies
    1. Yes, change your git pager configuration to just `less`

      Delete
    2. I have tried setting core.pager to 'less' as well as removing all color-related env vars, and I continue to get error 141 when I quit 'git log'. Any more ideas?

      Delete
    3. I set "pager = cat | less" to force all of stdin to be read before passing it to less

      :)

      Delete
  2. This bug can be seen often. Hope you were able to resolve this issue.

    Please click on the link below.
    Best Advanced Excel classes in Bangalore

    ReplyDelete
  3. Nice post keep do posting The Info was too good, for more information regarding the technology Click
    Amazon web Services Training
    Professional Salesforce CRM Training
    Salesforce Online Training in Bangalore

    ReplyDelete
  4. myTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance

    ReplyDelete
  5. When such problems arise, I try to immediately solve it because in the future it can lead to serious malfunctions.

    ReplyDelete
  6. Greetings! I just wanted to thank you for the published entry! You have helped us too much! We are glad we have found this source here.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Nice post I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great expereince with this
    Salesforce Training  which is a best institute for career building program.

    ReplyDelete
  10. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    workday studio online training
    best workday studio online training
    top workday studio online training

    ReplyDelete
  11. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. erek erek

    ReplyDelete
  12. They can't figure out why their co-worker isn't pulling his or her own weight and why the sales manager isn't doing anything about it. Salesforce training in Chennai

    ReplyDelete
  13. Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. polaris ranger

    ReplyDelete
  14. Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. log splitter

    ReplyDelete
  15. Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. creditcard online abn amro

    ReplyDelete
  16. A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post. goedkope taxi rotterdam

    ReplyDelete
  17. อีกทั้งเรายังให้บริการ เกมสล็อต ยิงปลา แทงบอลออนไลน์ รองรับทุกการใช้งานในอุปกรณ์ต่าง ๆ HTML5 คอมพิวเตอร์ แท็บเล็ต สมาทโฟน คาสิโนออนไลน์ และมือถือทุกรุ่น เล่นได้ตลอด 24ชม. ไม่ต้อง Downloads เกมส์ให้ยุ่งยาก ด้วยระบบที่เสถียรที่สุดในประเทศไทย

    ReplyDelete
  18. หาคุณกำลังหาเกมส์ออนไลน์ที่สามารถสร้างรายได้ให้กับคุณ เรามีเกมส์แนะนำ เกมยิงปลา รูปแบบใหม่เล่นง่ายบนมือถือ คาสิโนออนไลน์ บนคอม เล่นได้ทุกอุปกรณ์รองรับทุกเครื่องมือ มีให้เลือกเล่นหลายเกมส์ เล่นได้ทั่วโลกเพราะนี้คือเกมส์ออนไลน์แบบใหม่ เกมยิงปลา

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. Baccarat is money making plus it's spectacular availability. Optimal In your case it's being sold that you'll find pretty fascinating alternatives. And that is regarded as something that's very different And it's really a little something that's very happy to hit with Likely the most excellent, too, is a very positive choice. Furthermore, it's a really fascinating solution. It's the simplest way which could earn money. Superbly prepar The number of best-earning baccarat is the accessibility of making the most cash. Almost as possible is very ideal for you An alternative which may be guaranteed. To a wide variety of performance and supply And see outstanding benefits as well.บาคาร่า
    ufa
    ufabet
    แทงบอล
    แทงบอล
    แทงบอล

    ReplyDelete
  21. ได้โดยที่จะทำให้คุณนั้นสามารถสร้างกำไรจากการเล่นเกมส์เดิมพันออนไลน์ได้เราแนะนำเกมส์ชนิดนี้ให้คุณได้รู้จักก็เพราะว่าเชื่อว่าทุกคนนั้นจะต้องรู้วิธีการเล่นและวิธีการเอาชนะเกมม สล็อต าแทบทุกคนเพราะเราเคยเล่นกันมาตั้งแต่เด็กเด็กหาคุณได้เล่นเกมส์คาสิโนออนไลน์ที่คุณนั้นคุ้นเคยหรือจะเป็นสิ่งที่จะทำให้คุณสามารถที่จะได้กำไรจากการเล่นเกมได้มากกว่าที่คุณไปเล่นเกมส์คาสิโนออนไลน์ที่คุณนั้นไม่เคยเล่นมาก่อนและไม่คุ้นเคย เราจึงคิดว่าเกมส์ชนิดนี้เป็นเกมส์ที่น่าสนใจมากๆที่เราอยากจะมาแนะนำให้ทุกคนได้รู้จักและได้ใช้บริการ

    ReplyDelete
  22. Hi this is venky here to tell about that blog is usefull and topic featured in content is necessary.
    Digital marketing in Telugu

    ReplyDelete
  23. I really like your writing style, great information, thankyou for posting. 토토사이트

    ReplyDelete
  24. I really like your writing style, great information, thankyou for posting. 토토사이트

    ReplyDelete
  25. Cool stuff you have got and you keep update all of us. 토토사이트

    ReplyDelete
  26. This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff. 토토사이트

    ReplyDelete
  27. Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share. click here

    ReplyDelete
  28. Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share. click here

    ReplyDelete
  29. I know this if off topic but I'm looking into starting my own blog
    and was curious what all is needed to get setup? I'm assuming having a blog like yours would cost
    a pretty penny? I'm not very internet smart so I'm not 100% positive. Any tips or advice would be greatly appreciated.

    Review my webpage - 오피사이트
    (jk)

    ReplyDelete
  30. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it. 토토커뮤니티

    ReplyDelete
  31. Hi there! Nice post! Please tell us when I will see a follow up! 토토커뮤니티

    ReplyDelete
  32. Thanks For Sharing such a wonderful article the way you presented is really amazing
    Best Software Training Institutes

    ReplyDelete