git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] compat/mingw: stubs for getpgid() and tcgetpgrp()

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 16, 2015, 12:48 UTC
Message-ID
<02c7702c204914ddded4014f292a90bf@www.dscho.org>
In-Reply-To
<xmqq3841kz32.fsf@gitster.dls.corp.google.com>
Hi Junio,
On 2015-04-15 20:48, Junio C Hamano wrote:
Show 23 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> 
>> Windows does not have process groups. It is, therefore, the simplest
>> to pretend that each process is in its own process group.
>>
>> While here, move the getppid() stub from its old location (between
>> two sync related functions) next to the two new functions.
>>
>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>> ---
> 
> Thanks for a quick update.
> 
> The patch should do for now, but I suspect that it may give us a
> better abstraction to make the "is_foreground_fd(int fd)" or even
> "is_foreground(void)" the public API that would be implemented as
> 
> 	int we_are_in_the_foreground(void)
>         {
> 		return getpgid(0) == tcgetpgrp(fileno(stderr));
> 	}
> 
> in POSIX and Windows can implement entirely differently.
I really like it. We already require a couple of workarounds to be able to use `mintty` (which is a replacement terminal emulator that is more flexible than the default Windows terminal window, but it comes at the price that most Win32 programs think they are not running interactively inside a `mintty` session). I would really like to avoid having to finagle some really ugly code into `getpgid()` to make that test work.
In general, I find it rewarding not only from a portability point of view, but *especially* from a readability one if the code contains functions that are named semantically, i.e. they describe *why* they are called, not *how* they answer the question.
In this case, I would prefer the `is_foreground_fd(int fd)` one, but I am sure I can make the other signature work for us, too.

Ciao, Dscho

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Johannes SixtNext: Junio C Hamano
Message 10 of 20 in “reduce progress updates in background”
  1. reduce progress updates in backgroundLuke Mewburn, Apr 13, 2015
  2. Nicolas PitreApr 13, 2015
  3. Luke MewburnApr 13, 2015
  4. Nicolas PitreApr 13, 2015
  5. reduce progress updates in backgroundLuke Mewburn, Apr 14, 2015
  6. Nicolas PitreApr 14, 2015
  7. compat/mingw: stubs for getpgid() and tcgetpgrp()Johannes Sixt, Apr 15, 2015
  8. Junio C HamanoApr 15, 2015
  9. Johannes SixtApr 15, 2015
  10. Johannes SchindelinApr 16, 2015
  11. Junio C HamanoApr 16, 2015
  12. Erik Faye-LundApr 15, 2015
  13. Johannes SchindelinApr 16, 2015
  14. rupert thurnerApr 23, 2015
  15. rupert thurnerApr 24, 2015
  16. Johannes SchindelinApr 24, 2015
  17. Luke MewburnApr 17, 2015
  18. Luke MewburnApr 14, 2015
  19. brian m. carlsonApr 14, 2015
  20. Johannes SchindelinApr 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.