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

[PATCH] svn_io_run_cmd()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: 2002-02-05 16:45:39 CET

On 5 Feb 2002, Philip Martin wrote:

(I took the liberty of changing the subject as this changed focus here.)

> > APR had it by the time I mailed the patch too, but svn_io_run_cmd() did
> > not. I believe that situation hasn't changed. I may be mistaking of
> > course. Or I may use the function wrongly. Please point out my mistakes
> > if you can find any.
>
> You have become the ideal person to add the required support :-)
>
> I don't think it's a big change, svn_io_run_cmd is only called in two or
> three places, and you have some code that will exercise it.

You mean something like this?

* ./subversion/include/svn_io.h

  (svn_io_run_cmd) Added inherit argument

* ./subversion/libsvn_repos/hooks.c

 (run_cmd_with_output) modfified svn_io_run_cmd() call

* ./subversion/libsvn_subr/io.c

 (svn_io_run_cmd) take one more argument to specify whether the command to
 run should inherit our environment or not

 (svn_io_run_diff) invoke svn_io_run_cmd() with the new argument

* ./subversion/libsvn_wc/log.c

 (log_do_run_cmd) invoke svn_io_run_cmd() with the new argument

Index: subversion/include/svn_io.h
===================================================================
--- subversion/include/svn_io.h
+++ subversion/include/svn_io.h Tue Feb 5 16:39:23 2002
@@ -301,12 +301,16 @@
    EXITWHY will indicate why the process terminated.

    ARGS is a list of (const char *)'s, terminated by NULL. ARGS[0] is
- the name of the program, though it need not be the same as CMD. */
+ the name of the program, though it need not be the same as CMD.
+
+ INHERIT sets whether the invoked program shall inherit its environment or
+ run "clean". */
 svn_error_t *svn_io_run_cmd (const char *path,
                              const char *cmd,
                              const char *const *args,
                              int *exitcode,
                              apr_exit_why_e *exitwhy,
+ svn_boolean_t inherit,
                              apr_file_t *infile,
                              apr_file_t *outfile,
                              apr_file_t *errfile,
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c
+++ subversion/libsvn_repos/hooks.c Tue Feb 5 16:38:06 2002
@@ -59,8 +59,8 @@
       (apr_err, 0, NULL, pool,
        "run_cmd_with_output: can't open handle to stderr");

- return svn_io_run_cmd (".", cmd, args, exitcode, exitwhy, NULL, outhandle,
- errhandle, pool);
+ return svn_io_run_cmd (".", cmd, args, exitcode, exitwhy, FALSE,
+ NULL, outhandle, errhandle, pool);
 }

Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c
+++ subversion/libsvn_subr/io.c Tue Feb 5 16:37:47 2002
@@ -910,6 +910,9 @@
  * ARGS is a list of (const char *)'s, terminated by NULL.
  * ARGS[0] is the name of the program, though it need not be the same
  * as CMD.
+ *
+ * INHERIT sets whether the invoked program shall inherit its environment or
+ * run "clean".
  */
 svn_error_t *
 svn_io_run_cmd (const char *path,
@@ -917,6 +920,7 @@
                 const char *const *args,
                 int *exitcode,
                 apr_exit_why_e *exitwhy,
+ svn_boolean_t inherit,
                 apr_file_t *infile,
                 apr_file_t *outfile,
                 apr_file_t *errfile,
@@ -935,7 +939,8 @@
        cmd);

   /* Make sure we invoke cmd directly, not through a shell. */
- apr_err = apr_procattr_cmdtype_set (cmdproc_attr, APR_PROGRAM);
+ apr_err = apr_procattr_cmdtype_set (cmdproc_attr,
+ inherit?APR_PROGRAM_PATH:APR_PROGRAM);
   if (! APR_STATUS_IS_SUCCESS (apr_err))
     return svn_error_createf
       (apr_err, 0, NULL, pool,
@@ -1062,7 +1067,8 @@

   assert (i == nargs);

- SVN_ERR(svn_io_run_cmd (dir, SVN_CLIENT_DIFF, args, pexitcode, NULL, NULL,
+ SVN_ERR(svn_io_run_cmd (dir, SVN_CLIENT_DIFF, args, pexitcode,
+ NULL, FALSE, NULL,
                           outfile, errfile, subpool));

   if (*pexitcode < 0 || *pexitcode > 2)
Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c
+++ subversion/libsvn_wc/log.c Tue Feb 5 16:40:47 2002
@@ -304,7 +304,7 @@
                                   "error opening %s", errfile_path->data);
     }

- err = svn_io_run_cmd (loggy->path->data, name, args, NULL, NULL,
+ err = svn_io_run_cmd (loggy->path->data, name, args, NULL, NULL, FALSE,
                         infile, outfile, errfile, loggy->pool);
   if (err)
      return svn_error_createf (SVN_ERR_WC_BAD_ADM_LOG, 0, NULL, loggy->pool,

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:04 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.