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

Re: apr_proc_wait interface changes

From: Matt Kraai <kraai_at_alumni.carnegiemellon.edu>
Date: 2001-10-23 22:50:40 CEST

On Tue, Oct 23, 2001 at 10:47:54PM +0200, RADICS Peter wrote:
> apr_proc_wait() has a new argument now.
> this patch lets subversion build with it.

I also hacked up a patch to address this change. Here it is, in
case anyone is interested.

Matt

Index: ./subversion/include/svn_io.h
===================================================================
--- ./subversion/include/.svn/text-base/svn_io.h Tue Oct 23 11:43:06 2001
+++ ./subversion/include/svn_io.h Tue Oct 23 12:36:41 2001
@@ -25,6 +25,7 @@
 #include <apr.h>
 #include <apr_pools.h>
 #include <apr_file_io.h>
+#include <apr_thread_proc.h>
 
 #include "svn_types.h"
 #include "svn_error.h"
@@ -277,7 +278,8 @@
 svn_error_t *svn_io_run_cmd (const char *path,
                              const char *cmd,
                              const char *const *args,
- apr_wait_t *status,
+ int *exitcode,
+ apr_exit_why_e *exitwhy,
                              apr_file_t *infile,
                              apr_file_t *outfile,
                              apr_file_t *errfile,
Index: ./subversion/libsvn_wc/log.c
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/log.c Tue Oct 23 11:42:41 2001
+++ ./subversion/libsvn_wc/log.c Tue Oct 23 12:35:06 2001
@@ -142,7 +142,8 @@
 {
   svn_error_t *err;
   apr_status_t apr_err;
- apr_wait_t status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
   const char
     *infile_name,
     *outfile_name,
@@ -219,7 +220,7 @@
                                   "error opening %s", errfile_path->data);
     }
   
- err = svn_io_run_cmd (loggy->path->data, name, args, &status,
+ err = svn_io_run_cmd (loggy->path->data, name, args, &exitcode, &exitwhy,
                         infile, outfile, errfile, loggy->pool);
   if (err)
      return svn_error_createf (SVN_ERR_WC_BAD_ADM_LOG, 0, NULL, loggy->pool,
Index: ./subversion/libsvn_wc/get_editor.c
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/get_editor.c Tue Oct 23 11:42:39 2001
+++ ./subversion/libsvn_wc/get_editor.c Tue Oct 23 12:29:33 2001
@@ -1276,7 +1276,7 @@
                        "close_file: error starting diff process");
                   
                   /* Wait for the diff command to finish. */
- apr_err = apr_proc_wait (&diff_proc, NULL, APR_WAIT);
+ apr_err = apr_proc_wait (&diff_proc, NULL, NULL, APR_WAIT);
                   if (APR_STATUS_IS_CHILD_NOTDONE (apr_err))
                     return svn_error_createf
                       (apr_err, 0, NULL, fb->pool,
Index: ./subversion/libsvn_subr/io.c
===================================================================
--- ./subversion/libsvn_subr/.svn/text-base/io.c Tue Oct 23 11:42:36 2001
+++ ./subversion/libsvn_subr/io.c Tue Oct 23 12:34:28 2001
@@ -788,7 +788,8 @@
 svn_io_run_cmd (const char *path,
                 const char *cmd,
                 const char *const *args,
- apr_wait_t *status,
+ int *exitcode,
+ apr_exit_why_e *exitwhy,
                 apr_file_t *infile,
                 apr_file_t *outfile,
                 apr_file_t *errfile,
@@ -872,7 +873,7 @@
        cmd);
 
   /* Wait for the cmd command to finish. */
- apr_err = apr_proc_wait (&cmd_proc, status, APR_WAIT);
+ apr_err = apr_proc_wait (&cmd_proc, exitcode, exitwhy, APR_WAIT);
   if (APR_STATUS_IS_CHILD_NOTDONE (apr_err))
     return svn_error_createf
       (apr_err, 0, NULL, pool,
Index: ./subversion/svnlook/main.c
===================================================================
--- ./subversion/svnlook/.svn/text-base/main.c Tue Oct 23 11:42:25 2001
+++ ./subversion/svnlook/main.c Tue Oct 23 12:33:55 2001
@@ -468,7 +468,8 @@
     {
       const char *args[5];
       apr_file_t *outhandle;
- apr_wait_t status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
       apr_status_t apr_err;
 
       printf ("%s: %s\n",
@@ -494,7 +495,7 @@
           (apr_err, 0, NULL, pool,
            "print_diff_tree: can't open handle to stdout");
 
- SVN_ERR(svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, &status,
+ SVN_ERR(svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, &exitcode, &exitwhy,
                               NULL, outhandle, NULL, pool));
 
       /* TODO: Handle status == 2 (i.e. diff error) here. */
Index: ./subversion/clients/cmdline/diff.c
===================================================================
--- ./subversion/clients/cmdline/.svn/text-base/diff.c Tue Oct 23 11:41:22 2001
+++ ./subversion/clients/cmdline/diff.c Tue Oct 23 12:33:18 2001
@@ -107,7 +107,8 @@
   apr_status_t status;
   svn_stringbuf_t *pristine_copy_path;
   svn_boolean_t text_is_modified = FALSE;
- apr_wait_t proc_status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
   const char **args;
   int i = 0;
 
@@ -159,7 +160,7 @@
   apr_file_printf (outhandle, "Index: %s\n", path->data);
   apr_file_printf (outhandle, "===================================================================\n");
 
- SVN_ERR(svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, &proc_status,
+ SVN_ERR(svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, &exitcode, &exitwhy,
                         NULL, outhandle, NULL, pool));
 
   /* TODO: Handle proc_status == 2 (i.e. errors with diff) here */
Index: ./subversion/libsvn_repos/hooks.c
===================================================================
--- ./subversion/libsvn_repos/.svn/text-base/hooks.c Tue Oct 23 11:40:44 2001
+++ ./subversion/libsvn_repos/hooks.c Tue Oct 23 14:28:46 2001
@@ -40,7 +40,8 @@
 static svn_error_t *
 run_cmd_with_output (const char *cmd,
                      const char **args,
- apr_wait_t *status,
+ int *exitcode,
+ apr_exit_why_e *exitwhy,
                      apr_pool_t *pool)
 {
   apr_file_t *outhandle, *errhandle;
@@ -58,7 +59,7 @@
       (apr_err, 0, NULL, pool,
        "run_cmd_with_output: can't open handle to stderr");
 
- return svn_io_run_cmd (".", cmd, args, status, NULL, outhandle,
+ return svn_io_run_cmd (".", cmd, args, exitcode, exitwhy, NULL, outhandle,
                          errhandle, pool);
 }
 
@@ -76,7 +77,8 @@
   if ((! svn_io_check_path (svn_stringbuf_create (hook, pool), &kind, pool))
       && (kind == svn_node_file))
     {
- apr_wait_t status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
       svn_error_t *err;
       const char *args[4];
 
@@ -85,7 +87,7 @@
       args[2] = user;
       args[3] = NULL;
 
- if ((err = run_cmd_with_output (hook, args, &status, pool)))
+ if ((err = run_cmd_with_output (hook, args, &exitcode, &exitwhy, pool)))
         {
           return svn_error_createf
             (SVN_ERR_REPOS_HOOK_FAILURE, 0, err, pool,
@@ -111,7 +113,8 @@
       && (kind == svn_node_file))
     {
       svn_error_t *err;
- apr_wait_t status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
       const char *args[4];
 
       args[0] = hook;
@@ -119,13 +122,13 @@
       args[2] = txn_name;
       args[3] = NULL;
 
- if ((err = run_cmd_with_output (hook, args, &status, pool)))
+ if ((err = run_cmd_with_output (hook, args, &exitcode, &exitwhy, pool)))
         {
           return svn_error_createf
             (SVN_ERR_REPOS_HOOK_FAILURE, 0, err, pool,
              "run_pre_commit_hook: error running cmd `%s'", hook);
         }
- if (status != 0)
+ if (! APR_PROC_CHECK_EXIT (exitwhy) || exitcode != 0)
         {
           return svn_error_create
               (SVN_ERR_REPOS_HOOK_FAILURE, 0, err, pool,
@@ -151,7 +154,8 @@
       && (kind == svn_node_file))
     {
       svn_error_t *err;
- apr_wait_t status;
+ int exitcode;
+ apr_exit_why_e exitwhy;
       const char *args[4];
 
       args[0] = hook;
@@ -159,7 +163,7 @@
       args[2] = apr_psprintf (pool, "%lu", rev);
       args[3] = NULL;
 
- if ((err = run_cmd_with_output (hook, args, &status, pool)))
+ if ((err = run_cmd_with_output (hook, args, &exitcode, &exitwhy, pool)))
         {
           return svn_error_createf
             (SVN_ERR_REPOS_HOOK_FAILURE, 0, err, pool,

---------------------------------------------------------------------
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:36:45 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.