fork新建的进程里面system函数运行的shell命令不能运行
fork新建的进程里面system函数运行的shell命令不能运行?
vfork也不行,那里出问题了啊,
运行以后显示
run shell script fail, script exit code: 127
是没有权限,还是咋?
status = system("/bin/ls"); //加路径不加路径都不行
if (-1 == status)
{
printf("system error!");
}
else
{
printf("exit status value = [0x%x]\n", status);
if (WIFEXITED(status))
{
if (0 == WEXITSTATUS(status))
{
printf("run shell script successfully.\n");
}
else
{
printf("run shell script fail, script exit code: %d\n", WEXITSTATUS(status));
}
}
else
{
printf("exit status = [%d]\n", WEXITSTATUS(status));
}
}