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) ##[Window](#Window)
This is a work in progress. This is a work in progress.
#####[ShowAlert(support linux as soon as possible)](#ShowAlert) #####[ShowAlert](#ShowAlert)
#####[CloseWindow](#CloseWindow) #####[CloseWindow](#CloseWindow)
#####[IsValid](#IsValid) #####[IsValid](#IsValid)
#####[SetActive](#SetActive) #####[SetActive](#SetActive)

View File

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

View File

@ -39,7 +39,7 @@ import (
) )
const ( const (
version string = "v0.41.1.202,fate!" version string = "v0.41.1.204,fate!"
) )
//GetVersion get version //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 int xmessage(char *argv[], int *exit_status)
{ {
static const char * const MSG_PROGS[] = {"gmessage", "gxmessage", // static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
"kmessage", "xmessage"}; // "kmessage", "xmessage"};
static const char * const MSG_PROGS[] = {"xmessage"};
static int PREV_MSG_INDEX = -1; static int PREV_MSG_INDEX = -1;
#define MSG_PROGS_LEN (sizeof(MSG_PROGS) / sizeof(MSG_PROGS[0])) #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) static int runTask(const char *taskname, char * const argv[], int *exit_status)
{ {
pid_t pid; pid_t pid = fork();
int status; int status;
switch (pid = fork()) { switch (pid) {
case -1: /* Failed to fork */ case -1: /* Failed to fork */
perror("fork"); perror("fork");
return FORK_FAILED; /* Failed to fork. */ return FORK_FAILED; /* Failed to fork. */
case 0: /* Child process */ 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. */ exit(42); /* Failed to run task. */
default: /* Parent process */ default: /* Parent process */
wait(&status); /* Block execution until finished. */ wait(&status); /* Block execution until finished. */