Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
160464c0
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
160464c0
编写于
7月 22, 2022
作者:
wafwerar
提交者:
GitHub
7月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15275 from taosdata/fix/ZhiqiangWang/TD-17690-fix-taos-shell-ctrl-c-exit-error
shell: fix taos shell ctrl-c exit error
上级
3b090271
ec5db6e1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
20 deletion
+27
-20
cmake/cmake.options
cmake/cmake.options
+7
-0
include/os/osSignal.h
include/os/osSignal.h
+4
-0
include/os/osSystem.h
include/os/osSystem.h
+0
-3
source/os/src/osSystem.c
source/os/src/osSystem.c
+0
-6
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+3
-0
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+13
-11
未找到文件。
cmake/cmake.options
浏览文件 @
160464c0
...
@@ -51,6 +51,13 @@ IF(${TD_WINDOWS})
...
@@ -51,6 +51,13 @@ IF(${TD_WINDOWS})
"If build unit tests using googletest"
"If build unit tests using googletest"
ON
ON
)
)
option(
TDENGINE_3
"TDengine 3.x"
ON
)
ELSEIF (TD_DARWIN_64)
ELSEIF (TD_DARWIN_64)
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
option(
option(
...
...
include/os/osSignal.h
浏览文件 @
160464c0
...
@@ -44,7 +44,11 @@ extern "C" {
...
@@ -44,7 +44,11 @@ extern "C" {
#define SIGBREAK 1234
#define SIGBREAK 1234
#endif
#endif
#ifdef WINDOWS
typedef
BOOL
(
*
FSignalHandler
)(
DWORD
fdwCtrlType
);
#else
typedef
void
(
*
FSignalHandler
)(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
);
typedef
void
(
*
FSignalHandler
)(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
);
#endif
void
taosSetSignal
(
int32_t
signum
,
FSignalHandler
sigfp
);
void
taosSetSignal
(
int32_t
signum
,
FSignalHandler
sigfp
);
void
taosIgnSignal
(
int32_t
signum
);
void
taosIgnSignal
(
int32_t
signum
);
void
taosDflSignal
(
int32_t
signum
);
void
taosDflSignal
(
int32_t
signum
);
...
...
include/os/osSystem.h
浏览文件 @
160464c0
...
@@ -29,9 +29,6 @@ extern "C" {
...
@@ -29,9 +29,6 @@ extern "C" {
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#endif
#endif
#define TAOS_CONSOLE_PROMPT_HEADER "taos> "
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
typedef
struct
TdCmd
*
TdCmdPtr
;
typedef
struct
TdCmd
*
TdCmdPtr
;
TdCmdPtr
taosOpenCmd
(
const
char
*
cmd
);
TdCmdPtr
taosOpenCmd
(
const
char
*
cmd
);
...
...
source/os/src/osSystem.c
浏览文件 @
160464c0
...
@@ -18,10 +18,6 @@
...
@@ -18,10 +18,6 @@
#include "os.h"
#include "os.h"
#if defined(WINDOWS)
#if defined(WINDOWS)
BOOL
WINAPI
CtrlHandler
(
DWORD
fdwCtrlType
)
{
printf
(
"
\n
"
TAOS_CONSOLE_PROMPT_HEADER
);
return
TRUE
;
}
#elif defined(_TD_DARWIN_64)
#elif defined(_TD_DARWIN_64)
#else
#else
#include <dlfcn.h>
#include <dlfcn.h>
...
@@ -128,7 +124,6 @@ int taosSetConsoleEcho(bool on) {
...
@@ -128,7 +124,6 @@ int taosSetConsoleEcho(bool on) {
void
taosSetTerminalMode
()
{
void
taosSetTerminalMode
()
{
#if defined(WINDOWS)
#if defined(WINDOWS)
SetConsoleCtrlHandler
(
CtrlHandler
,
TRUE
);
#else
#else
struct
termios
newtio
;
struct
termios
newtio
;
...
@@ -179,7 +174,6 @@ int32_t taosGetOldTerminalMode() {
...
@@ -179,7 +174,6 @@ int32_t taosGetOldTerminalMode() {
void
taosResetTerminalMode
()
{
void
taosResetTerminalMode
()
{
#if defined(WINDOWS)
#if defined(WINDOWS)
SetConsoleCtrlHandler
(
CtrlHandler
,
FALSE
);
#else
#else
if
(
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
)
!=
0
)
{
if
(
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
)
!=
0
)
{
fprintf
(
stderr
,
"Fail to reset the terminal properties!
\n
"
);
fprintf
(
stderr
,
"Fail to reset the terminal properties!
\n
"
);
...
...
tools/shell/src/shellArguments.c
浏览文件 @
160464c0
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#include "shellInt.h"
#include "shellInt.h"
#define TAOS_CONSOLE_PROMPT_HEADER "taos> "
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
#define SHELL_HOST "The auth string to use when connecting to the server."
#define SHELL_HOST "The auth string to use when connecting to the server."
#define SHELL_PORT "The TCP/IP port number to use for the connection."
#define SHELL_PORT "The TCP/IP port number to use for the connection."
#define SHELL_USER "The user name to use when connecting to the server."
#define SHELL_USER "The user name to use when connecting to the server."
...
...
tools/shell/src/shellEngine.c
浏览文件 @
160464c0
...
@@ -41,7 +41,7 @@ static void shellPrintError(TAOS_RES *tres, int64_t st);
...
@@ -41,7 +41,7 @@ static void shellPrintError(TAOS_RES *tres, int64_t st);
static
bool
shellIsCommentLine
(
char
*
line
);
static
bool
shellIsCommentLine
(
char
*
line
);
static
void
shellSourceFile
(
const
char
*
file
);
static
void
shellSourceFile
(
const
char
*
file
);
static
void
shellGetGrantInfo
();
static
void
shellGetGrantInfo
();
static
void
shellQueryInterruptHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
);
static
void
shellCleanup
(
void
*
arg
);
static
void
shellCleanup
(
void
*
arg
);
static
void
*
shellCancelHandler
(
void
*
arg
);
static
void
*
shellCancelHandler
(
void
*
arg
);
static
void
*
shellThreadLoop
(
void
*
arg
);
static
void
*
shellThreadLoop
(
void
*
arg
);
...
@@ -919,11 +919,14 @@ void shellGetGrantInfo() {
...
@@ -919,11 +919,14 @@ void shellGetGrantInfo() {
fprintf
(
stdout
,
"
\r\n
"
);
fprintf
(
stdout
,
"
\r\n
"
);
}
}
void
shellQueryInterruptHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
tsem_post
(
&
shell
.
cancelSem
);
}
#ifdef WINDOWS
BOOL
shellQueryInterruptHandler
(
DWORD
fdwCtrlType
)
{
void
shellSigintHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
tsem_post
(
&
shell
.
cancelSem
);
// do nothing
return
TRUE
;
}
}
#else
void
shellQueryInterruptHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
tsem_post
(
&
shell
.
cancelSem
);
}
#endif
void
shellCleanup
(
void
*
arg
)
{
taosResetTerminalMode
();
}
void
shellCleanup
(
void
*
arg
)
{
taosResetTerminalMode
();
}
...
@@ -934,11 +937,10 @@ void *shellCancelHandler(void *arg) {
...
@@ -934,11 +937,10 @@ void *shellCancelHandler(void *arg) {
taosMsleep
(
10
);
taosMsleep
(
10
);
continue
;
continue
;
}
}
taos_kill_query
(
shell
.
conn
);
taosResetTerminalMode
();
#ifdef WINDOWS
printf
(
"
\r\n
Receive SIGTERM or other signal, quit shell.
\r\n
"
);
printf
(
"
\n
%s"
,
shell
.
info
.
promptHeader
);
shellWriteHistory
();
#endif
shellExit
();
}
}
return
NULL
;
return
NULL
;
...
@@ -1022,7 +1024,7 @@ int32_t shellExecute() {
...
@@ -1022,7 +1024,7 @@ int32_t shellExecute() {
taosSetSignal
(
SIGHUP
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGHUP
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGABRT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGABRT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGINT
,
shell
Sigin
tHandler
);
taosSetSignal
(
SIGINT
,
shell
QueryInterrup
tHandler
);
shellGetGrantInfo
();
shellGetGrantInfo
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录