From: Jeff King <peff@peff.net>
To: Alexey Shumkin <alex.crezoff@gmail.com>
Cc: git@vger.kernel.org, Chris Packham <judge.packham@gmail.com>
Subject: Re: [PATCH] git-web--browser: avoid errors in terminal when running Firefox on Windows
Date: Fri, 11 Nov 2011 15:26:36 -0500 [thread overview]
Message-ID: <20111111202636.GA20515@sigill.intra.peff.net> (raw)
In-Reply-To: <20111111234830.32dccd87@zappedws>
On Fri, Nov 11, 2011 at 11:48:30PM +0400, Alexey Shumkin wrote:
> > 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
Even that's not foolproof, as the open and write are not atomic (so you
could see it's there, but read an empty file). But in this case, we
really just care that the thing ran, not that it writes any specific
output. So you could probably get away with something like:
cat >fake-browser <<\EOF &&
#!/bin/sh
>fake-browser-ran
EOF
git web--browse ... &&
{
for timeout in 1 2 3 4 5; do
test -f fake-browser-ran && break
sleep 1
done
test "$timeout" -ne 5
}
which would note success as soon as possible (to within a one second
margin), but would eventually give up after 5 seconds. So you'd get a
false positive on a _very_ loaded system, but that's kind of unlikely.
I dunno. Maybe this hackery is OK, or maybe it just isn't worth it, and
we should declare this as something that's too hard to test to make it
into our test suite.
-Peff
next prev parent reply other threads:[~2011-11-11 20:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 0:44 [PATCHv3] git-web--browse: avoid the use of eval Chris Packham
2011-10-03 9:57 ` Jeff King
[not found] ` <1321028283-17307-1-git-send-email-Alex.Crezoff@gmail.com>
2011-11-11 18:35 ` [PATCH] git-web--browser: avoid errors in terminal when running Firefox on Windows Jeff King
2011-11-11 19:48 ` Alexey Shumkin
2011-11-11 20:26 ` Jeff King [this message]
2013-01-25 14:44 ` Alexey Shumkin
2013-01-25 19:49 ` Junio C Hamano
2013-01-26 0:40 ` [PATCH v2 0/2] git-web--browser: avoid errors in terminal when running Alexey Shumkin
2013-01-26 0:40 ` [PATCH v2 1/2] t9901-git-web--browse.sh: Use "write_script" helper Alexey Shumkin
2013-01-26 0:40 ` [PATCH v2 2/2] git-web--browser: avoid errors in terminal when running Firefox on Windows Alexey Shumkin
2013-01-25 22:06 ` [PATCH] " Jeff King
2013-01-25 22:52 ` Shumkin Alexey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111111202636.GA20515@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=alex.crezoff@gmail.com \
--cc=git@vger.kernel.org \
--cc=judge.packham@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).