On Wed, 2 Jul 2008, Neiss, Guenter wrote:
>
> /* Create a temporary file F that will automatically be deleted when it is
> closed. Fill it with VALUE, and leave it open and rewound, ready to be
> read from. */
> static svn_error_t *
> create_temp_file(apr_file_t **f, const svn_string_t *value, apr_pool_t *pool)
> {
> const char *dir;
> apr_off_t offset = 0;
>
> SVN_ERR(svn_io_temp_dir(&dir, pool));
> SVN_ERR(svn_io_open_unique_file2(f, NULL,
> svn_path_join(dir, "hook-input", pool),
> "", svn_io_file_del_on_close, pool));
> SVN_ERR(svn_io_file_write_full(*f, value->data, value->len, NULL, pool));
> SVN_ERR(svn_io_file_seek(*f, APR_SET, &offset, pool));
> return SVN_NO_ERROR;
> }
>
Looking at the code I see this function only used to create a file for use
as stdin of a hook script.
Wouldn't it be better to start the hook with a pipe as stdin and write the
contents of 'value' directly to the pipe instead of creating a temp file?
Just my 2 cents.
Martin
PS: Issue #2791 contains two patches which add support for pipes, i guess
it wouldn't be hard to add the stdin pipe for hooks.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-03 21:35:49 CEST