diff options
author | Erlang/OTP <[email protected]> | 2018-03-21 18:16:46 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2018-03-21 18:16:46 +0100 |
commit | 5af1c7339be4ad3ec6336e32207cfa70535a5440 (patch) | |
tree | f10cd9d49bd78d914d4e5317fb8ab35b22fc0c11 /lib/kernel/doc/src/os.xml | |
parent | 33521da61673b890bcd05eda02f38fea1fe58a30 (diff) | |
parent | bf4418b4bb9166a6a27937b53710d2b4d30925af (diff) | |
download | otp-5af1c7339be4ad3ec6336e32207cfa70535a5440.tar.gz otp-5af1c7339be4ad3ec6336e32207cfa70535a5440.tar.bz2 otp-5af1c7339be4ad3ec6336e32207cfa70535a5440.zip |
Merge branch 'sverker/maint-19/os-cmd-2/OTP-14823' into maint-19
* sverker/maint-19/os-cmd-2/OTP-14823:
kernel: Fix os_SUITE:max_size_command for OTP-19
kernel: Fix handling of os:cmd option max_size in win
kernel: Add os:cmd/2 with max_size option
Diffstat (limited to 'lib/kernel/doc/src/os.xml')
-rw-r--r-- | lib/kernel/doc/src/os.xml | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml index 739ac35d2a..a6a63448b7 100644 --- a/lib/kernel/doc/src/os.xml +++ b/lib/kernel/doc/src/os.xml @@ -38,17 +38,35 @@ most platforms.</p> </description> + <datatypes> + <datatype> + <name name="os_command"/> + </datatype> + <datatype> + <name name="os_command_opts"/> + <desc> + <p>Options for <seealso marker="#cmd/2"><c>os:cmd/2</c></seealso></p> + <taglist> + <tag><c>max_size</c></tag> + <item> + <p>The maximum size of the data returned by the <c>os:cmd</c> call. + See the <seealso marker="#cmd/2"><c>os:cmd/2</c></seealso> + documentation for more details.</p> + </item> + </taglist> + </desc> + </datatype> + </datatypes> + <funcs> <func> <name name="cmd" arity="1"/> + <name name="cmd" arity="2"/> <fsummary>Execute a command in a shell of the target OS.</fsummary> <desc> <p>Executes <c><anno>Command</anno></c> in a command shell of the - target OS, - captures the standard output of the command, and returns this - result as a string. This function is a replacement of - the previous function <c>unix:cmd/1</c>; they are equivalent on a - Unix platform.</p> + target OS, captures the standard output of the command, + and returns this result as a string.</p> <p><em>Examples:</em></p> <code type="none"> LsOut = os:cmd("ls"), % on unix platform @@ -57,6 +75,21 @@ DirOut = os:cmd("dir"), % on Win32 platform</code> called from another program (for example, <c>os:cmd/1</c>) can differ, compared with the standard output of the command when called directly from an OS command shell.</p> + <p><c>os:cmd/2</c> was added in kernel-5.5 (OTP-20.2.1). It makes it + possible to pass an options map as the second argument in order to + control the behaviour of <c>os:cmd</c>. The possible options are: + </p> + <taglist> + <tag><c>max_size</c></tag> + <item> + <p>The maximum size of the data returned by the <c>os:cmd</c> call. + This option is a safety feature that should be used when the command + executed can return a very large, possibly infinite, result.</p> + <code type="none"> +> os:cmd("cat /dev/zero", #{ max_size => 20 }). +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]</code> + </item> + </taglist> </desc> </func> |