apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42365] New: - Suppress console for apr_proc_create() created process
Date Wed, 09 May 2007 13:11:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42365>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42365

           Summary: Suppress console for apr_proc_create() created process
           Product: APR
           Version: 1.2.8
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: Joe.Mudd@sas.com


I am creating child processes with:

   aStatus = apr_procattr_io_set(attr, APR_CHILD_BLOCK, APR_PARENT_BLOCK,
                                 APR_PARENT_BLOCK);
   ...
   aStatus = apr_procattr_cmdtype_set(attr, APR_SHELLCMD);

When created on Windows a console window is created.  I have added a new 
procattr call (apr_procattr_terminal_set) to allow the suppression of the 
console window.  Below are the diffs associated with the update.

Thanks for your consideration.

--- ../apr-1.2.8/./threadproc/netware/proc.c	Thu Aug  3 07:05:28 2006
+++ ./threadproc/netware/proc.c	Wed May  9 08:35:35 2007
@@ -47,6 +47,7 @@
     /* Default to a current path since NetWare doesn't handle it very well */
     apr_filepath_get(&((*new)->currdir), APR_FILEPATH_NATIVE, pool);
     (*new)->detached = 1;
+    (*new)->terminal = 1;
     return APR_SUCCESS;
 
 }
@@ -183,6 +184,13 @@
     attr->detached = detach;
     return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal)
+{
+    attr->terminal = terminal;
+    return APR_SUCCESS;
+}
 
 #if APR_HAS_FORK
 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
--- ../apr-1.2.8/./threadproc/win32/proc.c	Thu Aug  3 07:05:28 2006
+++ ./threadproc/win32/proc.c	Wed May  9 08:38:57 2007
@@ -58,6 +58,7 @@
     (*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t));
     (*new)->pool = pool;
     (*new)->cmdtype = APR_PROGRAM;
+    (*new)->terminal = 1;
     return APR_SUCCESS;
 }
 
@@ -201,6 +202,13 @@
     return APR_SUCCESS;
 }
 
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal)
+{
+    attr->terminal = terminal;
+    return APR_SUCCESS;
+}
+
 static apr_status_t attr_cleanup(void *theattr)
 {
     apr_procattr_t *attr = (apr_procattr_t *)theattr;    
@@ -396,6 +404,15 @@
     new->out = attr->parent_out;
     new->err = attr->parent_err;
 
+    if (!attr->terminal) {
+        /* If we are launching a console application that is to run
+         * without a console window and we are not Win9x, let Windows
+         * know that we do not want a console.
+         */
+        if (apr_os_level >= APR_WIN_NT)
+             dwCreationFlags |= CREATE_NO_WINDOW;
+    }
+
     if (attr->detached) {
         /* If we are creating ourselves detached, Then we should hide the
          * window we are starting in.  And we had better redfine our
--- ../apr-1.2.8/./threadproc/beos/proc.c	Thu Aug  3 07:05:28 2006
+++ ./threadproc/beos/proc.c	Wed May  9 08:34:30 2007
@@ -41,6 +41,7 @@
     (*new)->currdir = NULL; 
     (*new)->cmdtype = APR_PROGRAM;
     (*new)->detached = 0;
+    (*new)->terminal = 1;
     return APR_SUCCESS;
 }
 
@@ -141,6 +142,13 @@
     attr->detached = detach;
     return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal)
+{
+    attr->terminal = terminal;
+    return APR_SUCCESS;
+}
 
 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
 {
--- ../apr-1.2.8/./threadproc/unix/proc.c	Thu Aug  3 07:05:28 2006
+++ ./threadproc/unix/proc.c	Wed May  9 08:37:21 2007
@@ -31,6 +31,7 @@
     (*new)->pool = pool;
     (*new)->cmdtype = APR_PROGRAM;
     (*new)->uid = (*new)->gid = -1;
+    (*new)->terminal = 1;
     return APR_SUCCESS;
 }
 
@@ -188,6 +189,13 @@
     attr->detached = detach;
     return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal)
+{
+    attr->terminal = terminal;
+    return APR_SUCCESS;
+}
 
 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
 {
--- ../apr-1.2.8/./threadproc/os2/proc.c	Thu Aug  3 07:05:28 2006
+++ ./threadproc/os2/proc.c	Wed May  9 08:36:38 2007
@@ -52,6 +52,7 @@
     (*new)->currdir = NULL; 
     (*new)->cmdtype = APR_PROGRAM;
     (*new)->detached = FALSE;
+    (*new)->terminal = TRUE;
     return APR_SUCCESS;
 }
 
@@ -188,6 +189,13 @@
     attr->detached = detach;
     return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal)
+{
+    attr->terminal = terminal;
+    return APR_SUCCESS;
+}
 
 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
 {
--- ../apr-1.2.8/./include/apr_thread_proc.h	Thu Aug  3 07:05:28 2006
+++ ./include/apr_thread_proc.h	Wed May  9 08:31:50 2007
@@ -473,6 +473,16 @@
 APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, 
                                                  apr_int32_t detach);
 
+
+/**
+ * Determine if the child should start with a terminal.
+ * @param attr The procattr we care about.
+ * @param background Should the child start with a terminal?  Default is yes.
+ */
+APR_DECLARE(apr_status_t) apr_procattr_terminal_set(apr_procattr_t *attr,
+                                                 apr_int32_t terminal);
+
+
 #if APR_HAVE_STRUCT_RLIMIT
 /**
  * Set the Resource Utilization limits when starting a new process.
--- ../apr-1.2.8/./include/arch/netware/apr_arch_threadproc.h	Thu Aug  3 
07:05:28 2006
+++ ./include/arch/netware/apr_arch_threadproc.h	Wed May  9 08:40:28 2007
@@ -61,6 +61,7 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
+    apr_int32_t terminal;
     apr_int32_t addrspace;
 };
 
--- ../apr-1.2.8/./include/arch/win32/apr_arch_threadproc.h	Thu Aug  3 
07:05:28 2006
+++ ./include/arch/win32/apr_arch_threadproc.h	Wed May  9 08:39:47 2007
@@ -55,6 +55,7 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
+    apr_int32_t terminal;
     apr_child_errfn_t *errfn;
     apr_int32_t errchk;
 #ifndef _WIN32_WCE
--- ../apr-1.2.8/./include/arch/beos/apr_arch_threadproc.h	Thu Aug  3 
07:05:28 2006
+++ ./include/arch/beos/apr_arch_threadproc.h	Wed May  9 08:40:48 2007
@@ -84,6 +84,7 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
+    apr_int32_t terminal;
 };
 
 struct apr_thread_once_t {
--- ../apr-1.2.8/./include/arch/unix/apr_arch_threadproc.h	Thu Aug  3 
07:05:28 2006
+++ ./include/arch/unix/apr_arch_threadproc.h	Wed May  9 08:40:01 2007
@@ -84,6 +84,7 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
+    apr_int32_t terminal;
 #ifdef RLIMIT_CPU
     struct rlimit *limit_cpu;
 #endif
--- ../apr-1.2.8/./include/arch/os2/apr_arch_threadproc.h	Thu Aug  3 
07:05:28 2006
+++ ./include/arch/os2/apr_arch_threadproc.h	Wed May  9 08:40:15 2007
@@ -56,6 +56,7 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
+    apr_int32_t terminal;
 };
 
 struct apr_thread_once_t {

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message