git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/4] Replace fork_with_pipe in bundle with run_command

From
Junio C Hamano <junkio@cox.net>
Date
Mar 12, 2007, 23:57 UTC
Message-ID
<7vslcaow13.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070312183815.GD15996@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 37 quoted lines
> Now that the run_command family supports all of the redirection
> modes needed by builtin-bundle, we can use those functions rather
> than the underlying POSIX primitives.  This should help to make the
> bundle command slightly more portable to other systems, like Windows.
>
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> ...
> @@ -263,9 +202,10 @@ static int create_bundle(struct bundle_header *header, const char *path,
>  	int bundle_fd = -1;
>  	const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));
>  	const char **argv_pack = xmalloc(5 * sizeof(const char *));
> -	int pid, in, out, i, status, ref_count = 0;
> +	int i, status, ref_count = 0;
>  	char buffer[1024];
>  	struct rev_info revs;
> +	struct child_process rls;
>  
>  	bundle_fd = (!strcmp(path, "-") ? 1 :
>  			open(path, O_CREAT | O_EXCL | O_WRONLY, 0666));
> ...
>  			write_or_die(bundle_fd, buffer, i);
> @@ -303,11 +245,8 @@ static int create_bundle(struct bundle_header *header, const char *path,
>  			object->flags |= SHOWN;
>  		}
>  	}
> -	while ((i = waitpid(pid, &status, 0)) < 0)
> -		if (errno != EINTR)
> -			return error("rev-list died");
> -	if (!WIFEXITED(status) || WEXITSTATUS(status))
> -		return error("rev-list died %d", WEXITSTATUS(status));
> +	if (finish_command(&rls))
> +		return error("rev-list died");
> ...
> +	if (finish_command(&rls))
>  		return error ("pack-objects died");
>  
>  	return status;
As the variable 'status' is not used anymore, I think this should return 0.
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 2 of 5 in “Replace fork_with_pipe in bundle with run_command”
  1. 4/4 Replace fork_with_pipe in bundle with run_commandShawn O. Pearce, Mar 12, 2007
  2. Junio C HamanoMar 12, 2007
  3. Shawn O. PearceMar 13, 2007
  4. Junio C HamanoMar 13, 2007
  5. Shawn O. PearceMar 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.