Fix grep invocations

This commit is contained in:
Tuncer Ayaz 2011-01-09 14:22:50 +01:00
parent bb6731208e
commit ebcae06928
2 changed files with 23 additions and 13 deletions

View file

@ -162,14 +162,19 @@ referenced_dtls1(Step, Config, Seen) ->
DtlOpts = erlydtl_opts(Config), DtlOpts = erlydtl_opts(Config),
ExtMatch = re:replace(option(source_ext, DtlOpts), "\.", "\\\\\\\\.", ExtMatch = re:replace(option(source_ext, DtlOpts), "\.", "\\\\\\\\.",
[{return, list}]), [{return, list}]),
ShOpts = [{use_stdout, false}, return_on_error],
AllRefs = AllRefs =
lists:append( lists:append(
[begin [begin
{ok, Res} = rebar_utils:sh( Cmd = lists:flatten(["grep -o [^\\\"]*",
lists:flatten(["grep -o [^\\\"]*", ExtMatch, " ", F]),
ExtMatch," ",F]), case rebar_utils:sh(Cmd, ShOpts) of
[{use_stdout, false}]), {ok, Res} ->
string:tokens(Res, "\n") string:tokens(Res, "\n");
{error, _} ->
""
end
end || F <- Step]), end || F <- Step]),
DocRoot = option(doc_root, DtlOpts), DocRoot = option(doc_root, DtlOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ], WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],

View file

@ -122,13 +122,18 @@ referenced_pegs1(Step, Config, Seen) ->
ExtMatch = re:replace(option(source_ext, NeoOpts), "\.", "\\\\\\\\.", ExtMatch = re:replace(option(source_ext, NeoOpts), "\.", "\\\\\\\\.",
[{return, list}]), [{return, list}]),
AllRefs = lists:append([begin ShOpts = [{use_stdout, false}, return_on_error],
{ok, Res} = AllRefs =
rebar_utils:sh( lists:append(
lists:flatten(["grep -o [^\\\"]*", [begin
Cmd = lists:flatten(["grep -o [^\\\"]*",
ExtMatch, " ", F]), ExtMatch, " ", F]),
[{use_stdout, false}]), case rebar_utils:sh(Cmd, ShOpts) of
string:tokens(Res, "\n") {ok, Res} ->
string:tokens(Res, "\n");
{error, _} ->
""
end
end || F <- Step]), end || F <- Step]),
DocRoot = option(doc_root, NeoOpts), DocRoot = option(doc_root, NeoOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ], WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],