Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Backström (FKA Larsson) <[email protected]>
  • Loading branch information
yarisx and garazdawi authored Oct 25, 2024
1 parent 7af29a1 commit 98e2413
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/kernel/src/os.erl
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ cmd(Cmd) ->
-doc """
Executes `Command` in a command shell of the target OS, captures the standard
output and standard error of the command, and returns this result as a string.
The command shell can be set using the
[kernel configuration parameter](kernel_app.md#os_cmd_shell), by default the
shell is detected upon system startup.
Expand Down
18 changes: 10 additions & 8 deletions lib/kernel/test/os_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end_per_group(_GroupName, Config) ->
Config.

init_per_testcase(TC, Config)
when TC =:= background_command; TC =:= close_stdin; TC =:= os_cmd_shell ->
when TC =:= background_command; TC =:= close_stdin ->
case os:type() of
{win32, _} ->
{skip,"Should not work on windows"};
Expand Down Expand Up @@ -475,13 +475,15 @@ os_cmd_shell(Config) ->
SysShell = filename:join(DataDir, "sys_shell"),

{ok, OldShell} = application:get_env(kernel, os_cmd_shell),
application:set_env(kernel, os_cmd_shell, SysShell),

%% os:cmd should not try to detect the shell location rather than use
%% the value from kernel:os_cmd_shell parameter
Ls = os:cmd("ls"),
application:set_env(kernel, os_cmd_shell, OldShell),
comp("sys_shell", Ls).
try
application:set_env(kernel, os_cmd_shell, SysShell),

%% os:cmd should not try to detect the shell location rather than use
%% the value from kernel:os_cmd_shell parameter
comp("sys_shell", os:cmd("ls"))
after
application:set_env(kernel, os_cmd_shell, OldShell),
end.

no_limit_for_opened_files() ->
case os:type() of
Expand Down

0 comments on commit 98e2413

Please sign in to comment.