@@ -588,16 +588,10 @@ 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- Port . command ( port , contents )
595- # Use this as a signal to close the port since we cannot
596- # send an exit command to mysql in batch mode
597- Port . command ( port , ";SELECT '__ECTO_EOF__';\n " )
598- result = collect_output ( port , "" )
599- Process . flag ( :trap_exit , old_trap_exit )
600- result
592+ send ( port , { self ( ) , { :command , contents } } )
593+ send ( port , { self ( ) , { :command , ";SELECT '__ECTO_EOF__';\n " } } )
594+ collect_output ( port , "" )
601595 end
602596
603597 defp args_env ( opts , opt_args ) do
@@ -657,9 +651,6 @@ defmodule Ecto.Adapters.MyXQL do
657651 collect_output ( port , acc )
658652 end
659653
660- { :EXIT , ^ port , _reason } ->
661- { acc , 1 }
662-
663654 { ^ port , { :exit_status , status } } ->
664655 { acc , status }
665656 end
0 commit comments