On Apr 24, 2009, at 10:05 AM, Jean-François Mertens wrote:
>
> On 24 Apr 2009, at 10:42, Martin Costabel wrote:
>
>> Charles Lepple wrote:
>> []
>>> 'grep -c' should be able to cope with empty input (returning 0), as
>>> long as you are passing a regex (in this case,
>>> 'org.finkproject.dbus-
>>> session'). Are you sure it isn't something else?
>>
>> Well, I tried this: On 10.4.11, I run
>>
>> launchctl list | grep -c foo
>>
>> It returns "0" eventually, but it can take a long time to do so,
>> sometimes up to a minute.
>>
>> This is not deterministic; sometimes it returns immediately. A simple
>> "launchctl list" returns immediately every time, as does the
>> command I
>> proposed,
>>
>> (echo ""; launchctl list) | grep -c foo
>>
>> Weird.
>>
>
> Really weird ...
> Trying to confirm this, I get, on 10.4.11,
>
>> # while true; do time { launchctl list | grep -c foo ; } ; done
>> 2>&1 | fgrep real
>> real 0m4.101s
>> real 0m0.058s
>> real 0m0.030s
>> real 0m0.024s
>> real 0m0.037s
>> ...
> all the rest of the same order; only the first is long.
> And launchctl list | wc -l gives only 15
Looks like you're testing this as root. If you run this as a regular
user with no other launchd jobs, that's when 'launchctl list' might
return nothing.
> On 10.5, all results are between .5 and 1 second; with no difference
> between
> the first and subsequent ones.
> There launchctl list | wc -l gives 142 ...
>
> (All this is with fink's grep, but I don't think grep is at issue
> here ..)
I wouldn't rule out potential differences in grep. Also, the
parentheses that Martin used add a subshell to the pipeline.
Martin, can you still fix the delay by using '{ echo ""; launchctl
list; }' instead of '( echo ""; launchctl list )'?
Also, have we established that everyone is actually using /bin/bash
for the command-line tests?
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Fink-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-users