[Xfce4-commits] <xfce4-genmon-plugin:master> Display error output from commands

Florian Rivoal noreply at xfce.org
Thu Feb 24 15:26:07 CET 2011


Updating branch refs/heads/master
         to 3e3b98960f8415db6f67f211057f1c02e058e615 (commit)
       from 9288f4ad58340a33621be8fb61780e1a7be6d5ea (commit)

commit 3e3b98960f8415db6f67f211057f1c02e058e615
Author: Steve Tyler <stephent98 at hotmail.com>
Date:   Thu Feb 24 20:14:58 2011 +0900

    Display error output from commands
    
    Fixes bug #4049.

 panel-plugin/cmdspawn.c |   12 +++++-------
 panel-plugin/cmdspawn.h |    5 ++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/panel-plugin/cmdspawn.c b/panel-plugin/cmdspawn.c
index d8d6e46..894942d 100644
--- a/panel-plugin/cmdspawn.c
+++ b/panel-plugin/cmdspawn.c
@@ -146,9 +146,8 @@ static int ParseCmdline (const char *const p_pcCmdLine, char ***p_pppcArgv, ...
 int genmon_Spawn (char *const argv[], char *const p_pcOutput,
     const size_t p_BufferSize, const int wait)
 /**********************************************************************/
- /* Spawn a command and capture its output */
- /* Return 0 on success, otherwise copy stderr into the output string and
-    return -1 */
+ /* Spawn a command and capture its output from stdout or stderr */
+ /* Return 0 on success, otherwise -1 */
 {
     enum { OUT, ERR, OUT_ERR };
     enum { RD, WR, RD_WR };
@@ -227,7 +226,7 @@ int genmon_Spawn (char *const argv[], char *const p_pcOutput,
                 break;
         if (i < OUT_ERR)
             read (aaiPipe[i][RD], p_pcOutput, BufSafeSize);
-        fError = (i != OUT);
+        fError = (i == OUT_ERR);
 
         /* Remove trailing carriage return if any */
         if (p_pcOutput[(i = strlen (p_pcOutput) - 1)] == '\n')
@@ -247,9 +246,8 @@ int genmon_Spawn (char *const argv[], char *const p_pcOutput,
 int genmon_SpawnCmd (const char *const p_pcCmdLine, char *const p_pcOutput,
     const size_t p_BufferSize, const int wait)
 /**********************************************************************/
- /* Spawn a command and capture its output */
- /* Return 0 on success, otherwise copy stderr into the output string and
-    return -1 */
+ /* Parse a command line, spawn the command, and capture its output from stdout or stderr */
+ /* Return 0 on success, otherwise -1 */
 {
     char          **argv;
     int             argc;
diff --git a/panel-plugin/cmdspawn.h b/panel-plugin/cmdspawn.h
index e8b99f1..b12d44d 100644
--- a/panel-plugin/cmdspawn.h
+++ b/panel-plugin/cmdspawn.h
@@ -40,9 +40,8 @@ extern "C" {
     int genmon_SpawnCmd (const char *const cmdline,
         char *const StdOutCapture,
         const size_t StdOutSize, const int wait);
-    /* Spawn the given command and capture its output (stdout) */
-    /* Return 0 on success, otherwise copy stderr into the output string
-       and return -1 */
+        /* Parse a command line, spawn the command, and capture its output from stdout or stderr */
+        /* Return 0 on success, otherwise -1 */
 #ifdef __cplusplus
 }/* extern "C" */
 #endif



More information about the Xfce4-commits mailing list