Skip to content

Commit ba48be7

Browse files
restore old trap exit
1 parent b541c12 commit ba48be7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/ecto/adapters/myxql.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,15 @@ defmodule Ecto.Adapters.MyXQL do
589589
]
590590

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

601603
defp args_env(opts, opt_args) do
@@ -659,7 +661,7 @@ defmodule Ecto.Adapters.MyXQL do
659661
{acc, 1}
660662

661663
{^port, {:exit_status, status}} ->
662-
collect_output(port, acc)
664+
{acc, status}
663665
end
664666
end
665667
end

0 commit comments

Comments
 (0)