[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: apr_setprocattr_childin on Win32

From: Bill Tutt <billtut_at_microsoft.com>
Date: 2000-12-19 11:05:02 CET

That wasn't all that bad. The only bummer is that apr_create_process() still
won't work on Win9x if you want to use APR_SHELLCMD due to a bug in Win9x
(KB: Q150956)

Diff sent as an attachment to prevent Outlook from goofing things up.

* aprlib.def: Export apr_setprocattr_childin, apr_setprocattr_childout, and
* threadproc/win32/proc.c: Folded pipe creation out into helper function.
Moved inheritable-ness mucking from apr_create_process into
apr_setprocattr_* functions. Added apr_setprocattr_child*.

The test case follows: (gleaned from libsvn_wc:get_editor:close_file)


apr_status_t apr_err;
apr_proc_t diff_proc;
apr_procattr_t *diffproc_attr;
const char *diff_args[6];
apr_file_t *diff_file;
apr_pool_t *pool;

/* Init global memory pool */
apr_initialize ();
pool = svn_pool_create (NULL);

/* Create the process attributes. */
apr_err = apr_createprocattr_init (&diffproc_attr, pool);
if (! APR_STATUS_IS_SUCCESS (apr_err))
return apr_err;

/* Make sure we invoke diff directly, not through a shell. */
apr_err = apr_setprocattr_cmdtype (diffproc_attr, APR_PROGRAM);
if (! APR_STATUS_IS_SUCCESS (apr_err))
return apr_err;
/* Set io style. */
apr_err = apr_setprocattr_io (diffproc_attr, 0,
                              APR_CHILD_BLOCK, APR_CHILD_BLOCK);
if (! APR_STATUS_IS_SUCCESS (apr_err))
return apr_err;

apr_err = apr_open(&diff_file, "d:\\log.txt", APR_WRITE | APR_CREATE,
                        APR_OS_DEFAULT, pool);

/* Tell it to send output to the diff file. */
apr_err = apr_setprocattr_childout (diffproc_attr,
if (! APR_STATUS_IS_SUCCESS (apr_err))
return apr_err;

/* Build the diff command. */
diff_args[0] = "diff";
diff_args[1] = "-c";
diff_args[2] = "--";
diff_args[3] = "d:\\SVN\\subversion\\apr\\threadproc\\win32\\proc.c.old";
diff_args[4] = "d:\\SVN\\subversion\\apr\\threadproc\\win32\\proc.c";
diff_args[5] = NULL;
apr_err = apr_create_process (&diff_proc,
if (! APR_STATUS_IS_SUCCESS (apr_err))
return apr_err;
/* Wait for the diff command to finish. */
apr_err = apr_wait_proc (&diff_proc, APR_WAIT);
return apr_err;


Received on Sat Oct 21 14:36:17 2006

This is an archived mail posted to the Subversion Dev mailing list.