Skip to content

为命令添加exit code功能,方便集成到shell中使用 #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jemygraw opened this issue Feb 6, 2017 · 3 comments
Closed

为命令添加exit code功能,方便集成到shell中使用 #69

jemygraw opened this issue Feb 6, 2017 · 3 comments
Labels
enhancement Anything around developer experience or feature request.

Comments

@jemygraw
Copy link
Contributor

jemygraw commented Feb 6, 2017

对于每个命令,返回的exit code如下
0 默认,表示命令执行成功
1 表示命令执行出现错误,一般是执行过程中遇到了错误,具体错误可以查看日志或者终端输出
2 表示命令的输入参数不正确,命令没有执行

集成:

  1. shell里面可以在命令执行之后通过 echo $? 来测试
  2. c语言里面参考代码如下:
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
int main()
{
	int code=system("./main");
	printf("%d\n",WEXITSTATUS(code));
}
@jemygraw jemygraw added the enhancement Anything around developer experience or feature request. label Feb 6, 2017
@jemygraw
Copy link
Contributor Author

jemygraw commented Feb 6, 2017

qshell -v
qshell -h

返回0

@jemygraw
Copy link
Contributor Author

jemygraw commented Feb 6, 2017

FIXED in 5837d8d

@jemygraw
Copy link
Contributor Author

jemygraw commented Feb 6, 2017

发布 2.0.2 版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Anything around developer experience or feature request.
Projects
None yet
Development

No branches or pull requests

1 participant