Skip to content

Commit 2d01aa1

Browse files
author
José Valim
committed
Do not pass false into port command
Signed-off-by: José Valim <[email protected]>
1 parent ae07124 commit 2d01aa1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/elixir/lib/system.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,18 +431,18 @@ defmodule System do
431431
@spec cmd(binary, [binary], Keyword.t) ::
432432
{Collectable.t, exit_status :: non_neg_integer}
433433
def cmd(command, args, opts \\ []) when is_binary(command) and is_list(args) do
434-
command = String.to_char_list(command)
434+
cmd = String.to_char_list(command)
435435

436-
command =
437-
if Path.type(command) == :absolute do
438-
command
436+
cmd =
437+
if Path.type(cmd) == :absolute do
438+
cmd
439439
else
440-
:os.find_executable(command)
440+
:os.find_executable(cmd) || :erlang.error(:enoent, [command, args, opts])
441441
end
442442

443443
{into, opts} = cmd_opts(opts, [:use_stdio, :exit_status, :binary, :hide, args: args], "")
444444
{initial, fun} = Collectable.into(into)
445-
do_cmd Port.open({:spawn_executable, command}, opts), initial, fun
445+
do_cmd Port.open({:spawn_executable, cmd}, opts), initial, fun
446446
end
447447

448448
defp do_cmd(port, acc, fun) do

0 commit comments

Comments
 (0)