From 55e929c4ed5cd854038c18697123ea94948ebf35 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 13 Dec 2017 11:22:45 +0100 Subject: kernel: Add os:cmd/2 with max_size option --- lib/kernel/doc/src/os.xml | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml index 0e9add4161..7ce2f54542 100644 --- a/lib/kernel/doc/src/os.xml +++ b/lib/kernel/doc/src/os.xml @@ -38,17 +38,35 @@ most platforms.

+ + + + + + + +

Options for os:cmd/2

+ + max_size + +

The maximum size of the data returned by the os:cmd call. + See the os:cmd/2 + documentation for more details.

+
+
+
+
+
+ + Execute a command in a shell of the target OS.

Executes Command 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 unix:cmd/1; they are equivalent on a - Unix platform.

+ target OS, captures the standard output of the command, + and returns this result as a string.

Examples:

LsOut = os:cmd("ls"), % on unix platform @@ -57,6 +75,21 @@ DirOut = os:cmd("dir"), % on Win32 platform called from another program (for example, os:cmd/1) can differ, compared with the standard output of the command when called directly from an OS command shell.

+

os:cmd/2 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 os:cmd. The possible options are: +

+ + max_size + +

The maximum size of the data returned by the os:cmd call. + This option is a safety feature that should be used when the command + executed can return a very large, possibly infinite, result.

+ +> 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] +
+
-- cgit v1.2.3 From e11c649522be8849cc21e364734be62c7783f090 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Mon, 12 Feb 2018 13:38:43 +0100 Subject: Update release notes --- lib/kernel/doc/src/notes.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index d7f224c38e..65fe9b9c07 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -31,6 +31,26 @@

This document describes the changes made to the Kernel application.

+
Kernel 5.4.2 + +
Fixed Bugs and Malfunctions + + +

+ Add os:cmd/2 that takes an options map as the + second argument.

+

+ Add max_size as an option to os:cmd/2 that + control the maximum size of the result that + os:cmd/2 will return.

+

+ Own Id: OTP-14823

+
+
+
+ +
+
Kernel 5.4.1
Fixed Bugs and Malfunctions -- cgit v1.2.3