@@ -1040,25 +1040,6 @@ defmodule System do
10401040 > such as `.exe`, and double check the program is indeed not a batch
10411041 > file or `.com` application.
10421042
1043- ## Examples
1044-
1045- iex> System.cmd("echo", ["hello"])
1046- {"hello\n", 0}
1047-
1048- iex> System.cmd("echo", ["hello"], env: [{"MIX_ENV", "test"}])
1049- {"hello\n", 0}
1050-
1051- If you want to stream the output to Standard IO as it arrives:
1052-
1053- iex> System.cmd("echo", ["hello"], into: IO.stream())
1054- hello
1055- {%IO.Stream{}, 0}
1056-
1057- If you want to read lines:
1058-
1059- iex> System.cmd("echo", ["hello\nworld"], into: [], lines: 1024)
1060- {["hello", "world"], 0}
1061-
10621043 ## Options
10631044
10641045 * `:into` - injects the result into the given collectable, defaults to `""`
@@ -1122,6 +1103,26 @@ defmodule System do
11221103
11231104 If you desire to execute a trusted command inside a shell, with pipes,
11241105 redirecting and so on, please check `shell/2`.
1106+
1107+ ## Examples
1108+
1109+ iex> System.cmd("echo", ["hello"])
1110+ {"hello\n", 0}
1111+
1112+ iex> System.cmd("echo", ["hello"], env: [{"MIX_ENV", "test"}])
1113+ {"hello\n", 0}
1114+
1115+ If you want to stream the output to Standard IO as it arrives:
1116+
1117+ iex> System.cmd("echo", ["hello"], into: IO.stream())
1118+ hello
1119+ {%IO.Stream{}, 0}
1120+
1121+ If you want to read lines:
1122+
1123+ iex> System.cmd("echo", ["hello\nworld"], into: [], lines: 1024)
1124+ {["hello", "world"], 0}
1125+
11251126 """
11261127 @ spec cmd ( binary , [ binary ] , cmd_opts ) :: { Collectable . t ( ) , exit_status :: non_neg_integer }
11271128 def cmd ( command , args , opts \\ [ ] ) when is_binary ( command ) and is_list ( args ) do
0 commit comments