Fix linux ShowAlert process

This commit is contained in:
vCaesar 2017-01-14 22:34:45 +08:00
parent dee7d7f7f9
commit 3c6d9b4fd9
4 changed files with 12 additions and 8 deletions

2
doc.md
View File

@ -56,7 +56,7 @@
##[Window](#Window)
This is a work in progress.
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
#####[ShowAlert](#ShowAlert)
#####[CloseWindow](#CloseWindow)
#####[IsValid](#IsValid)
#####[SetActive](#SetActive)

View File

@ -59,7 +59,7 @@
##[窗口](#Window)
This is a work in progress.
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
#####[ShowAlert](#ShowAlert)
#####[CloseWindow](#CloseWindow)
#####[IsValid](#IsValid)
#####[SetActive](#SetActive)

View File

@ -39,7 +39,7 @@ import (
)
const (
version string = "v0.41.1.202,fate!"
version string = "v0.41.1.204,fate!"
)
//GetVersion get version

View File

@ -123,8 +123,9 @@ static int runTask(const char *taskname, char * const argv[], int *exit_status);
static int xmessage(char *argv[], int *exit_status)
{
static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
"kmessage", "xmessage"};
// static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
// "kmessage", "xmessage"};
static const char * const MSG_PROGS[] = {"xmessage"};
static int PREV_MSG_INDEX = -1;
#define MSG_PROGS_LEN (sizeof(MSG_PROGS) / sizeof(MSG_PROGS[0]))
@ -155,15 +156,18 @@ static int xmessage(char *argv[], int *exit_status)
static int runTask(const char *taskname, char * const argv[], int *exit_status)
{
pid_t pid;
pid_t pid = fork();
int status;
switch (pid = fork()) {
switch (pid) {
case -1: /* Failed to fork */
perror("fork");
return FORK_FAILED; /* Failed to fork. */
case 0: /* Child process */
execvp(taskname, argv);
if (strcmp(argv[0],"xmessage") == 0){
execvp(taskname, argv);
perror("execvp failed");
}
exit(42); /* Failed to run task. */
default: /* Parent process */
wait(&status); /* Block execution until finished. */