Skip to content

Commit

Permalink
#40 fixed and tested in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bik committed Mar 17, 2017
1 parent c61b764 commit 89e64ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions c_src/erloci_drv/erloci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ int main(int argc, char * argv[])
#ifdef __WIN32__
_setmode( _fileno( stdout ), _O_BINARY );
_setmode( _fileno( stdin ), _O_BINARY );
DWORD pid = GetCurrentProcessId();
#else
pid_t pid = getpid();
#endif

transcoder::instance();
Expand Down Expand Up @@ -75,8 +78,8 @@ int main(int argc, char * argv[])
nls_lang = "";
REMOTE_LOG(
INF,
"Port process configs : erlang term max size 0x%08X bytes, logging %s, TCP port for logs %d,"
" NLS_LANG %s",
"[%lu] Port process configs : erlang term max size 0x%08X bytes, logging %s, TCP port for logs %d,"
" NLS_LANG %s", pid,
max_term_byte_size, (log_flag ? "enabled" : "disabled"), log_tcp_port, nls_lang);
threads::init();
port& prt = port::instance();
Expand All @@ -90,6 +93,11 @@ int main(int argc, char * argv[])
}
threads::run_threads = false;

REMOTE_LOG(DBG, "erloci terminating...");
REMOTE_LOG(DBG, "[%lu] terminating...", pid);
#ifdef __WIN32__
HANDLE hnd;
hnd = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, TRUE, pid);
TerminateProcess(hnd, 0);
#endif
return 0;
}
1 change: 1 addition & 0 deletions src/oci_port.erl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ start_exe(Executable, Logging, ListenPort, PortLogger, Options) ->
?Error(PortLogger, "oci could not open port: ~p", [Reason]),
{stop, Reason};
Port ->
link(Port),
case Logging of
true ->
port_command(Port, term_to_binary({undefined, ?RMOTE_MSG, ?DBG_FLAG_ON})),
Expand Down

0 comments on commit 89e64ce

Please sign in to comment.