Skip to content

Commit 2bdd35a

Browse files
change to message passing
1 parent bb837c3 commit 2bdd35a

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

lib/ecto/adapters/myxql.ex

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,9 @@ defmodule Ecto.Adapters.MyXQL do
588588
args: args
589589
]
590590

591-
# Trap exits in case mysql dies in the middle of execution so that we can surface the error
592-
old_trap_exit = Process.flag(:trap_exit, true)
593591
port = Port.open({:spawn_executable, abs_cmd}, port_opts)
594-
# Use this as a signal to close the port since we cannot
595-
# send an exit command to mysql in batch mode
596-
exit_signal = ";SELECT '__ECTO_EOF__';\n"
597-
Port.command(port, [contents, exit_signal])
592+
port ! {self(), {:command, contents}}
593+
port ! {self(), {:command, ";SELECT '__ECTO_EOF__';\n"}}
598594
result = collect_output(port, "")
599595
Process.flag(:trap_exit, old_trap_exit)
600596
result
@@ -657,9 +653,6 @@ defmodule Ecto.Adapters.MyXQL do
657653
collect_output(port, acc)
658654
end
659655

660-
{:EXIT, ^port, _reason} ->
661-
{acc, 1}
662-
663656
{^port, {:exit_status, status}} ->
664657
{acc, status}
665658
end

0 commit comments

Comments
 (0)