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

Re: [PATCH] git-web--browser: avoid errors in terminal when running Firefox on Windows

From
Alexey Shumkin <alex.crezoff@gmail.com>
Date
Nov 11, 2011, 19:48 UTC
Message-ID
<20111111234830.32dccd87@zappedws>
In-Reply-To
<20111111183555.GC16055@sigill.intra.peff.net>
Show 9 quoted lines
> >  test_expect_success \
> > +	'Firefox below v2.0 paths are properly quoted' '
> > +	echo fake: http://example.com/foo >expect &&
> > +	cat >"fake browser" <<-\EOF &&
> > +	#!/bin/sh
> > +
> > +	if [ "$1" == "-version" ]; then
> 
> Using "==" is a bashism. Just use "=".
Thanks (I have no skills enough in this area)
> 
> Also, a style nit, but we usually spell this "test" and not "[". I
> admit I don't care much, though.
Oh, I see
Show 17 quoted lines
> 
> > +		# Firefox (in contrast to w3m) is run in
> > background (with &)
> > +		# so redirect output to "actual"
> > +		echo fake: "$@" > actual
> > +	fi
> > +	EOF
> > +	chmod +x "fake browser" &&
> > +	git config browser.firefox.path "`pwd`/fake browser" &&
> > +	git web--browse --browser=firefox \
> > +		http://example.com/foo &&
> > +	test_cmp expect actual
> 
> Hmm. So we are running the fake browser in the background, but then
> check that it has written something as soon as web--browse exits.
> Isn't that a race condition? I.e., we could run "test_cmp" before the
> browser has actually written anything?

eeehh... you're right... but even on slow Windows Cygwin it is passed )

Show 5 quoted lines
> I'm not sure there's a good way to do it.  You would need either to
> wait some pre-determined "it could not possibly take it longer than N
> seconds to run" sleep, or we need some kind of synchronization point.
> We can't wait call "wait" on the child PID (if we even have it,
> because it's not our child).

hmm... we can delete "actual" file and wait its appearance (with some timeout), no ? but I didn't see in tests anything like this

> -Peff
Previous: Jeff KingNext: Jeff King
Message 4 of 12 in “[PATCHv3] git-web--browse: avoid the use of eval”
  1. Chris PackhamOct 2, 2011
  2. Jeff KingOct 3, 2011
  3. Jeff KingNov 11, 2011
  4. Alexey ShumkinNov 11, 2011
  5. Jeff KingNov 11, 2011
  6. git-web--browser: avoid errors in terminal when running Firefox on WindowsAlexey Shumkin, Jan 25, 2013
  7. Junio C HamanoJan 25, 2013
  8. 0/2 git-web--browser: avoid errors in terminal when runningAlexey Shumkin, Jan 26, 2013
  9. 1/2 t9901-git-web--browse.sh: Use "write_script" helperAlexey Shumkin, Jan 26, 2013
  10. 2/2 git-web--browser: avoid errors in terminal when running Firefox on WindowsAlexey Shumkin, Jan 26, 2013
  11. Jeff KingJan 25, 2013
  12. Shumkin AlexeyJan 25, 2013

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.