Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions lib/ecto/adapters/myxql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,10 @@ defmodule Ecto.Adapters.MyXQL do
args: args
]

# Trap exits in case mysql dies in the middle of execution so that we can surface the error
old_trap_exit = Process.flag(:trap_exit, true)
port = Port.open({:spawn_executable, abs_cmd}, port_opts)
Port.command(port, contents)
# Use this as a signal to close the port since we cannot
# send an exit command to mysql in batch mode
Port.command(port, ";SELECT '__ECTO_EOF__';\n")
result = collect_output(port, "")
Process.flag(:trap_exit, old_trap_exit)
result
send(port, {self(), {:command, contents}})
send(port, {self(), {:command, ";SELECT '__ECTO_EOF__';\n"}})
collect_output(port, "")
end

defp args_env(opts, opt_args) do
Expand Down Expand Up @@ -657,9 +651,6 @@ defmodule Ecto.Adapters.MyXQL do
collect_output(port, acc)
end

{:EXIT, ^port, _reason} ->
{acc, 1}

{^port, {:exit_status, status}} ->
{acc, status}
end
Expand Down
Loading