aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-06-26 09:06:09 +0200
committerHans Bolinder <[email protected]>2017-06-26 09:06:09 +0200
commitbd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6 (patch)
tree702e8975df7ec83b443338c2563cb86f8334ef42 /lib/syntax_tools
parent2f650c5bcd0cf19a0485d792229114f27bed3ca3 (diff)
parent9408d05ad6789496aab395cdcaf51625b95732cc (diff)
downloadotp-bd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6.tar.gz
otp-bd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6.tar.bz2
otp-bd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6.zip
Merge branch 'hasse/syntax_tools/erl_tidy_hangs/ERL-413/OTP-14471' into maint
* hasse/syntax_tools/erl_tidy_hangs/ERL-413/OTP-14471: syntax_tools: erl_tidy: Do not hang when exits are trapped
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;