diff --git a/lib/ecto/adapters/myxql.ex b/lib/ecto/adapters/myxql.ex index 6c706dfe..7f175bed 100644 --- a/lib/ecto/adapters/myxql.ex +++ b/lib/ecto/adapters/myxql.ex @@ -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 @@ -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