aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/os_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-09-05 17:08:40 +0200
committerLukas Larsson <[email protected]>2016-09-05 17:08:40 +0200
commitbb8d105fd6d5b09097dc64b341d63f0f8d7e8906 (patch)
treec3525db7d9b99e3048eedf3f6a16fe2cb46689e9 /lib/kernel/test/os_SUITE.erl
parentc26f34c7c8940de2ade904d86e581f2c7463549f (diff)
parentc0ed19c1261ee281d3c8f36ec3f28fa7328f0f39 (diff)
downloadotp-bb8d105fd6d5b09097dc64b341d63f0f8d7e8906.tar.gz
otp-bb8d105fd6d5b09097dc64b341d63f0f8d7e8906.tar.bz2
otp-bb8d105fd6d5b09097dc64b341d63f0f8d7e8906.zip
Merge branch 'lukas/kernel/os_cmd_fix_stdin_close/OTP-13867' into maint
* lukas/kernel/os_cmd_fix_stdin_close/OTP-13867: kernel: Close stdin of commands run in os:cmd
Diffstat (limited to 'lib/kernel/test/os_SUITE.erl')
-rw-r--r--lib/kernel/test/os_SUITE.erl17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index 5b6e0ab223..e76d6ec482 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -25,7 +25,7 @@
-export([space_in_cwd/1, quoting/1, cmd_unicode/1, space_in_name/1, bad_command/1,
find_executable/1, unix_comment_in_command/1, deep_list_command/1,
large_output_command/1, background_command/0, background_command/1,
- message_leak/1, perf_counter_api/1]).
+ message_leak/1, close_stdin/0, close_stdin/1, perf_counter_api/1]).
-include_lib("common_test/include/ct.hrl").
@@ -37,7 +37,7 @@ all() ->
[space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command,
find_executable, unix_comment_in_command, deep_list_command,
large_output_command, background_command, message_leak,
- perf_counter_api].
+ close_stdin, perf_counter_api].
groups() ->
[].
@@ -54,7 +54,8 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-init_per_testcase(background_command, Config) ->
+init_per_testcase(TC, Config)
+ when TC =:= background_command; TC =:= close_stdin ->
case os:type() of
{win32, _} ->
{skip,"Should not work on windows"};
@@ -302,6 +303,16 @@ message_leak(_Config) ->
process_flag(trap_exit, false).
+%% Test that os:cmd closes stdin of the program that is executed
+close_stdin() ->
+ [{timetrap, {seconds, 5}}].
+close_stdin(Config) ->
+ DataDir = proplists:get_value(data_dir, Config),
+ Fds = filename:join(DataDir, "my_fds"),
+
+ "-1" = os:cmd(Fds).
+
+
%% Test that the os:perf_counter api works as expected
perf_counter_api(_Config) ->