You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/02/02 21:58:26 UTC
svn commit: r1239841 - in /subversion/trunk/subversion: include/svn_io.h
libsvn_subr/deprecated.c libsvn_subr/io.c
Author: stsp
Date: Thu Feb 2 20:58:25 2012
New Revision: 1239841
URL: http://svn.apache.org/viewvc?rev=1239841&view=rev
Log:
Allow callers of svn_io_start_cmd() to specify custom environments the
child process should inherit.
This commit enhances the svn_io_start_cmd() API, but nothing uses the
new functionality yet.
* subversion/include/svn_io.h
(svn_io_start_cmd3): Declare.
(svn_io_start_cmd2): Deprecate.
* subversion/libsvn_subr/deprecated.c
(svn_io_start_cmd2): Re-implement as wrapper around svn_io_start_cmd3().
* subversion/libsvn_subr/io.c
(svn_io_start_cmd3): New. Like svn_io_start_cmd2(), but with a new
ENV parameter that can be used to inherit a custom environment to
the child process.
Modified:
subversion/trunk/subversion/include/svn_io.h
subversion/trunk/subversion/libsvn_subr/deprecated.c
subversion/trunk/subversion/libsvn_subr/io.c
Modified: subversion/trunk/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=1239841&r1=1239840&r2=1239841&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_io.h (original)
+++ subversion/trunk/subversion/include/svn_io.h Thu Feb 2 20:58:25 2012
@@ -1531,10 +1531,35 @@ svn_io_dir_walk(const char *dirname,
* Otherwise, the invoked program runs with an empty environment and @a cmd
* must be an absolute path.
*
+ * If @a inherit is FALSE and @a env is not NULL, the invoked program
+ * inherits the environment defined by @a env, instead of an empty
+ * environment or the caller's environment.
+ *
* @note On some platforms, failure to execute @a cmd in the child process
* will result in error output being written to @a errfile, if non-NULL, and
* a non-zero exit status being returned to the parent process.
*
+ * @since New in 1.8.
+ */
+svn_error_t *svn_io_start_cmd3(apr_proc_t *cmd_proc,
+ const char *path,
+ const char *cmd,
+ const char *const *args,
+ const char *const *env,
+ svn_boolean_t inherit,
+ svn_boolean_t infile_pipe,
+ apr_file_t *infile,
+ svn_boolean_t outfile_pipe,
+ apr_file_t *outfile,
+ svn_boolean_t errfile_pipe,
+ apr_file_t *errfile,
+ apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_io_start_cmd3() but with @a env always set to NULL.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API
* @since New in 1.7.
*/
svn_error_t *svn_io_start_cmd2(apr_proc_t *cmd_proc,
Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1239841&r1=1239840&r2=1239841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_subr/deprecated.c Thu Feb 2 20:58:25 2012
@@ -767,6 +767,24 @@ svn_io_get_dirents(apr_hash_t **dirents,
}
svn_error_t *
+svn_io_start_cmd2(apr_proc_t *cmd_proc,
+ const char *path,
+ const char *cmd,
+ const char *const *args,
+ svn_boolean_t inherit,
+ svn_boolean_t infile_pipe,
+ apr_file_t *infile,
+ svn_boolean_t outfile_pipe,
+ apr_file_t *outfile,
+ svn_boolean_t errfile_pipe,
+ apr_file_t *errfile,
+ apr_pool_t *pool)
+{
+ return svn_io_start_cmd3(cmd_proc, path, cmd, args, NULL, inherit, FALSE,
+ infile, FALSE, outfile, FALSE, errfile, pool);
+}
+
+svn_error_t *
svn_io_start_cmd(apr_proc_t *cmd_proc,
const char *path,
const char *cmd,
Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1239841&r1=1239840&r2=1239841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Thu Feb 2 20:58:25 2012
@@ -2417,10 +2417,11 @@ handle_child_process_error(apr_pool_t *p
svn_error_t *
-svn_io_start_cmd2(apr_proc_t *cmd_proc,
+svn_io_start_cmd3(apr_proc_t *cmd_proc,
const char *path,
const char *cmd,
const char *const *args,
+ const char *const *env,
svn_boolean_t inherit,
svn_boolean_t infile_pipe,
apr_file_t *infile,
@@ -2542,8 +2543,8 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
/* Start the cmd command. */
- apr_err = apr_proc_create(cmd_proc, cmd_apr, args_native, NULL,
- cmdproc_attr, pool);
+ apr_err = apr_proc_create(cmd_proc, cmd_apr, args_native,
+ inherit ? NULL : env, cmdproc_attr, pool);
if (apr_err)
return svn_error_wrap_apr(apr_err, _("Can't start process '%s'"), cmd);