summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2011-01-09 14:22:50 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2011-01-13 17:39:14 +0100
commitebcae06928c431a36187153b4c8f3d4366479051 (patch)
tree3c61da899e887ac74aad4ba91b31e0f83c2aed29 /src
parentbb6731208e1dce5255e820d5c5fe2763aa491991 (diff)
Fix grep invocations
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlydtl_compiler.erl15
-rw-r--r--src/rebar_neotoma_compiler.erl21
2 files changed, 23 insertions, 13 deletions
diff --git a/src/rebar_erlydtl_compiler.erl b/src/rebar_erlydtl_compiler.erl
index d30b56c..35a548d 100644
--- a/src/rebar_erlydtl_compiler.erl
+++ b/src/rebar_erlydtl_compiler.erl
@@ -162,14 +162,19 @@ referenced_dtls1(Step, Config, Seen) ->
DtlOpts = erlydtl_opts(Config),
ExtMatch = re:replace(option(source_ext, DtlOpts), "\.", "\\\\\\\\.",
[{return, list}]),
+
+ ShOpts = [{use_stdout, false}, return_on_error],
AllRefs =
lists:append(
[begin
- {ok, Res} = rebar_utils:sh(
- lists:flatten(["grep -o [^\\\"]*",
- ExtMatch," ",F]),
- [{use_stdout, false}]),
- string:tokens(Res, "\n")
+ Cmd = lists:flatten(["grep -o [^\\\"]*",
+ ExtMatch, " ", F]),
+ case rebar_utils:sh(Cmd, ShOpts) of
+ {ok, Res} ->
+ string:tokens(Res, "\n");
+ {error, _} ->
+ ""
+ end
end || F <- Step]),
DocRoot = option(doc_root, DtlOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],
diff --git a/src/rebar_neotoma_compiler.erl b/src/rebar_neotoma_compiler.erl
index e67007c..e46caf4 100644
--- a/src/rebar_neotoma_compiler.erl
+++ b/src/rebar_neotoma_compiler.erl
@@ -122,14 +122,19 @@ referenced_pegs1(Step, Config, Seen) ->
ExtMatch = re:replace(option(source_ext, NeoOpts), "\.", "\\\\\\\\.",
[{return, list}]),
- AllRefs = lists:append([begin
- {ok, Res} =
- rebar_utils:sh(
- lists:flatten(["grep -o [^\\\"]*",
- ExtMatch, " ", F]),
- [{use_stdout, false}]),
- string:tokens(Res, "\n")
- end || F <- Step]),
+ ShOpts = [{use_stdout, false}, return_on_error],
+ AllRefs =
+ lists:append(
+ [begin
+ Cmd = lists:flatten(["grep -o [^\\\"]*",
+ ExtMatch, " ", F]),
+ case rebar_utils:sh(Cmd, ShOpts) of
+ {ok, Res} ->
+ string:tokens(Res, "\n");
+ {error, _} ->
+ ""
+ end
+ end || F <- Step]),
DocRoot = option(doc_root, NeoOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],
Existing = [F || F <- WithPaths, filelib:is_regular(F)],