aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-06-16 10:22:45 +0200
committerHans Bolinder <[email protected]>2017-06-22 09:16:34 +0200
commit9408d05ad6789496aab395cdcaf51625b95732cc (patch)
tree846f17143a9b3d958acd3c99b48dbd2f94746df7 /lib/syntax_tools
parent040bdce67f88d833bfb59adae130a4ffb4c180f0 (diff)
downloadotp-9408d05ad6789496aab395cdcaf51625b95732cc.tar.gz
otp-9408d05ad6789496aab395cdcaf51625b95732cc.tar.bz2
otp-9408d05ad6789496aab395cdcaf51625b95732cc.zip
syntax_tools: erl_tidy: Do not hang when exits are trapped
See also ERL-413, https://bugs.erlang.org/browse/ERL-413.
Diffstat (limited to 'lib/syntax_tools')
-rw-r--r--lib/syntax_tools/src/erl_tidy.erl2
-rw-r--r--lib/syntax_tools/test/syntax_tools_SUITE.erl6
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl
index 1ca60ea73b..888cb71f51 100644
--- a/lib/syntax_tools/src/erl_tidy.erl
+++ b/lib/syntax_tools/src/erl_tidy.erl
@@ -301,6 +301,8 @@ file(Name, Opts) ->
{Child, ok} ->
ok;
{Child, {error, Reason}} ->
+ exit(Reason);
+ {'EXIT', Child, Reason} ->
exit(Reason)
end.
diff --git a/lib/syntax_tools/test/syntax_tools_SUITE.erl b/lib/syntax_tools/test/syntax_tools_SUITE.erl
index 868f43b8ee..ae2c67c03e 100644
--- a/lib/syntax_tools/test/syntax_tools_SUITE.erl
+++ b/lib/syntax_tools/test/syntax_tools_SUITE.erl
@@ -239,6 +239,12 @@ t_erl_tidy(Config) when is_list(Config) ->
DataDir = ?config(data_dir, Config),
File = filename:join(DataDir,"erl_tidy_tilde.erl"),
ok = erl_tidy:file(File, [{stdout, true}]),
+
+ %% OTP-14471.
+ Old = process_flag(trap_exit, true),
+ NonExisting = filename:join(DataDir,"non_existing_file.erl"),
+ {'EXIT',{error,{0,file,enoent}}} = (catch erl_tidy:file(NonExisting)),
+ true = process_flag(trap_exit, Old),
ok.
test_comment_scan([],_) -> ok;