mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-02 06:38:04 +00:00
FSCORE-472
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15209 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fb929dec8e
commit
7c00a6e59c
@ -842,12 +842,13 @@ SWITCH_DECLARE(void) switch_console_loop(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
char cmd[2048] = "";
|
char cmd[2048] = "";
|
||||||
int32_t activity = 1, r;
|
int32_t activity = 1;
|
||||||
gethostname(hostname, sizeof(hostname));
|
gethostname(hostname, sizeof(hostname));
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
int32_t arg;
|
int32_t arg;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
DWORD read, i;
|
||||||
HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
|
HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
INPUT_RECORD in[128];
|
INPUT_RECORD in[128];
|
||||||
#else
|
#else
|
||||||
@ -864,12 +865,7 @@ SWITCH_DECLARE(void) switch_console_loop(void)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\nfreeswitch@%s> ", hostname);
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\nfreeswitch@%s> ", hostname);
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
r = WaitForSingleObject(stdinHandle, 200);
|
|
||||||
activity = 0;
|
activity = 0;
|
||||||
|
|
||||||
if (r == WAIT_OBJECT_0) {
|
|
||||||
DWORD bytes = 0;
|
|
||||||
DWORD read, i;
|
|
||||||
PeekConsoleInput(stdinHandle, in, 128, &read);
|
PeekConsoleInput(stdinHandle, in, 128, &read);
|
||||||
for (i = 0; i < read; i++) {
|
for (i = 0; i < read; i++) {
|
||||||
if (in[i].EventType == KEY_EVENT && !in[i].Event.KeyEvent.bKeyDown) {
|
if (in[i].EventType == KEY_EVENT && !in[i].Event.KeyEvent.bKeyDown) {
|
||||||
@ -877,9 +873,12 @@ SWITCH_DECLARE(void) switch_console_loop(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity) {
|
if (activity) {
|
||||||
|
DWORD bytes = 0;
|
||||||
char *end;
|
char *end;
|
||||||
ReadConsole(stdinHandle, cmd, sizeof(cmd), &bytes, NULL);
|
ReadConsole(stdinHandle, cmd, sizeof(cmd), &bytes, NULL);
|
||||||
|
FlushConsoleInputBuffer(stdinHandle);
|
||||||
end = end_of_p(cmd);
|
end = end_of_p(cmd);
|
||||||
while(*end == '\r' || *end == '\n') {
|
while(*end == '\r' || *end == '\n') {
|
||||||
*end-- = '\0';
|
*end-- = '\0';
|
||||||
@ -890,8 +889,7 @@ SWITCH_DECLARE(void) switch_console_loop(void)
|
|||||||
running = switch_console_process(cmd, 0);
|
running = switch_console_process(cmd, 0);
|
||||||
memset(cmd, 0, sizeof(cmd));
|
memset(cmd, 0, sizeof(cmd));
|
||||||
}
|
}
|
||||||
|
Sleep(20);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_ZERO(&efds);
|
FD_ZERO(&efds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user