blob: 186902512782022e1086129b85f9ac8f6aea7b26 [file] [log] [blame]
Junio C Hamano3dac5042007-12-15 08:40:541<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamano61525f92014-01-17 22:46:496<meta name="generator" content="AsciiDoc 8.6.6" />
Junio C Hamano103b5722011-01-31 05:03:457<title>run-command API</title>
Junio C Hamano3dac5042007-12-15 08:40:548<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano3dac5042007-12-15 08:40:5424}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamano915cd9b2008-07-20 01:24:1730a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano3dac5042007-12-15 08:40:5437
38em {
39 font-style: italic;
Junio C Hamano103b5722011-01-31 05:03:4540 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:5441}
42
43strong {
44 font-weight: bold;
Junio C Hamano103b5722011-01-31 05:03:4545 color: #083194;
Junio C Hamano3dac5042007-12-15 08:40:5446}
47
Junio C Hamano3dac5042007-12-15 08:40:5448h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:5450 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamano915cd9b2008-07-20 01:24:1755h1, h2, h3 {
Junio C Hamano3dac5042007-12-15 08:40:5456 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano3dac5042007-12-15 08:40:5459 padding-top: 0.5em;
60}
Junio C Hamano915cd9b2008-07-20 01:24:1761h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamano3dac5042007-12-15 08:40:5470
71div.sectionbody {
Junio C Hamano3dac5042007-12-15 08:40:5472 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano103b5722011-01-31 05:03:4584ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano103b5722011-01-31 05:03:4589
Junio C Hamano61525f92014-01-17 22:46:4990pre {
Junio C Hamano3dac5042007-12-15 08:40:5491 padding: 0;
92 margin: 0;
93}
94
Junio C Hamano9d971152012-12-19 00:43:1195#author {
Junio C Hamano3dac5042007-12-15 08:40:5496 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:5497 font-weight: bold;
Junio C Hamano915cd9b2008-07-20 01:24:1798 font-size: 1.1em;
Junio C Hamano3dac5042007-12-15 08:40:5499}
Junio C Hamano9d971152012-12-19 00:43:11100#email {
Junio C Hamano3dac5042007-12-15 08:40:54101}
Junio C Hamano9d971152012-12-19 00:43:11102#revnumber, #revdate, #revremark {
Junio C Hamano3dac5042007-12-15 08:40:54103}
104
Junio C Hamano9d971152012-12-19 00:43:11105#footer {
Junio C Hamano3dac5042007-12-15 08:40:54106 font-size: small;
107 border-top: 2px solid silver;
108 padding-top: 0.5em;
109 margin-top: 4.0em;
110}
Junio C Hamano9d971152012-12-19 00:43:11111#footer-text {
Junio C Hamano3dac5042007-12-15 08:40:54112 float: left;
113 padding-bottom: 0.5em;
114}
Junio C Hamano9d971152012-12-19 00:43:11115#footer-badges {
Junio C Hamano3dac5042007-12-15 08:40:54116 float: right;
117 padding-bottom: 0.5em;
118}
119
Junio C Hamano9d971152012-12-19 00:43:11120#preamble {
Junio C Hamano103b5722011-01-31 05:03:45121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
Junio C Hamano9d971152012-12-19 00:43:11124div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano3dac5042007-12-15 08:40:54125div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
126div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22127 margin-top: 1.0em;
Junio C Hamano3dac5042007-12-15 08:40:54128 margin-bottom: 1.5em;
129}
130div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22131 margin-top: 2.0em;
132 margin-bottom: 2.0em;
133 margin-right: 10%;
134 color: #606060;
Junio C Hamano3dac5042007-12-15 08:40:54135}
136
137div.content { /* Block element content. */
138 padding: 0;
139}
140
141/* Block element titles. */
142div.title, caption.title {
Junio C Hamano103b5722011-01-31 05:03:45143 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:54144 font-weight: bold;
145 text-align: left;
146 margin-top: 1.0em;
147 margin-bottom: 0.5em;
148}
149div.title + * {
150 margin-top: 0;
151}
152
153td div.title:first-child {
154 margin-top: 0.0em;
155}
156div.content div.title:first-child {
157 margin-top: 0.0em;
158}
159div.content + div.title {
160 margin-top: 0.0em;
161}
162
163div.sidebarblock > div.content {
164 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11165 border: 1px solid #dddddd;
166 border-left: 4px solid #f0f0f0;
Junio C Hamano3dac5042007-12-15 08:40:54167 padding: 0.5em;
168}
169
170div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 5px solid #f0f0f0;
173 background: #f8f8f8;
Junio C Hamano3dac5042007-12-15 08:40:54174 padding: 0.5em;
175}
176
Junio C Hamano7bd050f2011-09-22 06:32:22177div.quoteblock, div.verseblock {
178 padding-left: 1.0em;
179 margin-left: 1.0em;
Junio C Hamano103b5722011-01-31 05:03:45180 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11181 border-left: 5px solid #f0f0f0;
182 color: #888;
Junio C Hamano3dac5042007-12-15 08:40:54183}
Junio C Hamano7bd050f2011-09-22 06:32:22184
Junio C Hamano103b5722011-01-31 05:03:45185div.quoteblock > div.attribution {
186 padding-top: 0.5em;
Junio C Hamano3dac5042007-12-15 08:40:54187 text-align: right;
188}
Junio C Hamano103b5722011-01-31 05:03:45189
Junio C Hamano9d971152012-12-19 00:43:11190div.verseblock > pre.content {
191 font-family: inherit;
192 font-size: inherit;
Junio C Hamano103b5722011-01-31 05:03:45193}
194div.verseblock > div.attribution {
195 padding-top: 0.75em;
196 text-align: left;
197}
198/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamano915cd9b2008-07-20 01:24:17199div.verseblock + div.attribution {
200 text-align: left;
201}
Junio C Hamano3dac5042007-12-15 08:40:54202
203div.admonitionblock .icon {
204 vertical-align: top;
205 font-size: 1.1em;
206 font-weight: bold;
207 text-decoration: underline;
208 color: #527bbd;
209 padding-right: 0.5em;
210}
211div.admonitionblock td.content {
212 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22213 border-left: 3px solid #dddddd;
Junio C Hamano3dac5042007-12-15 08:40:54214}
215
216div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22217 border-left: 3px solid #dddddd;
218 padding-left: 0.5em;
Junio C Hamano3dac5042007-12-15 08:40:54219}
220
Junio C Hamano3dac5042007-12-15 08:40:54221div.imageblock div.content { padding-left: 0; }
Junio C Hamano3dac5042007-12-15 08:40:54222span.image img { border-style: none; }
Junio C Hamano103b5722011-01-31 05:03:45223a.image:visited { color: white; }
Junio C Hamano3dac5042007-12-15 08:40:54224
225dl {
226 margin-top: 0.8em;
227 margin-bottom: 0.8em;
228}
229dt {
230 margin-top: 0.5em;
231 margin-bottom: 0;
Junio C Hamano103b5722011-01-31 05:03:45232 font-style: normal;
233 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:54234}
235dd > *:first-child {
Junio C Hamano103b5722011-01-31 05:03:45236 margin-top: 0.1em;
Junio C Hamano3dac5042007-12-15 08:40:54237}
238
239ul, ol {
240 list-style-position: outside;
241}
Junio C Hamano103b5722011-01-31 05:03:45242ol.arabic {
243 list-style-type: decimal;
244}
245ol.loweralpha {
Junio C Hamano3dac5042007-12-15 08:40:54246 list-style-type: lower-alpha;
247}
Junio C Hamano103b5722011-01-31 05:03:45248ol.upperalpha {
249 list-style-type: upper-alpha;
250}
251ol.lowerroman {
252 list-style-type: lower-roman;
253}
254ol.upperroman {
255 list-style-type: upper-roman;
256}
257
258div.compact ul, div.compact ol,
259div.compact p, div.compact p,
260div.compact div, div.compact div {
261 margin-top: 0.1em;
262 margin-bottom: 0.1em;
263}
Junio C Hamano3dac5042007-12-15 08:40:54264
Junio C Hamano3dac5042007-12-15 08:40:54265tfoot {
266 font-weight: bold;
267}
Junio C Hamano103b5722011-01-31 05:03:45268td > div.verse {
269 white-space: pre;
270}
Junio C Hamano103b5722011-01-31 05:03:45271
272div.hdlist {
Junio C Hamano3dac5042007-12-15 08:40:54273 margin-top: 0.8em;
274 margin-bottom: 0.8em;
275}
Junio C Hamano103b5722011-01-31 05:03:45276div.hdlist tr {
277 padding-bottom: 15px;
Junio C Hamano915cd9b2008-07-20 01:24:17278}
Junio C Hamano103b5722011-01-31 05:03:45279dt.hdlist1.strong, td.hdlist1.strong {
280 font-weight: bold;
281}
282td.hdlist1 {
Junio C Hamano3dac5042007-12-15 08:40:54283 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45284 font-style: normal;
Junio C Hamano3dac5042007-12-15 08:40:54285 padding-right: 0.8em;
Junio C Hamano103b5722011-01-31 05:03:45286 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:54287}
Junio C Hamano103b5722011-01-31 05:03:45288td.hdlist2 {
Junio C Hamano3dac5042007-12-15 08:40:54289 vertical-align: top;
290}
Junio C Hamano103b5722011-01-31 05:03:45291div.hdlist.compact tr {
292 margin: 0;
293 padding-bottom: 0;
294}
295
296.comment {
297 background: yellow;
298}
Junio C Hamano3dac5042007-12-15 08:40:54299
Junio C Hamano7bd050f2011-09-22 06:32:22300.footnote, .footnoteref {
301 font-size: 0.8em;
302}
303
304span.footnote, span.footnoteref {
305 vertical-align: super;
306}
307
308#footnotes {
309 margin: 20px 0 20px 0;
310 padding: 7px 0 0 0;
311}
312
313#footnotes div.footnote {
314 margin: 0 0 5px 0;
315}
316
317#footnotes hr {
318 border: none;
319 border-top: 1px solid silver;
320 height: 1px;
321 text-align: left;
322 margin-left: 0;
323 width: 20%;
324 min-width: 100px;
325}
326
Junio C Hamano9d971152012-12-19 00:43:11327div.colist td {
328 padding-right: 0.5em;
329 padding-bottom: 0.3em;
330 vertical-align: top;
331}
332div.colist td img {
333 margin-top: 0.3em;
Junio C Hamano3dac5042007-12-15 08:40:54334}
Junio C Hamano915cd9b2008-07-20 01:24:17335
Junio C Hamano9d971152012-12-19 00:43:11336@media print {
337 #footer-badges { display: none; }
338}
339
340#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22341 margin-bottom: 2.5em;
342}
343
Junio C Hamano9d971152012-12-19 00:43:11344#toctitle {
Junio C Hamano915cd9b2008-07-20 01:24:17345 color: #527bbd;
Junio C Hamano915cd9b2008-07-20 01:24:17346 font-size: 1.1em;
347 font-weight: bold;
348 margin-top: 1.0em;
349 margin-bottom: 0.1em;
350}
351
Junio C Hamano61525f92014-01-17 22:46:49352div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamano915cd9b2008-07-20 01:24:17353 margin-top: 0;
354 margin-bottom: 0;
355}
356div.toclevel2 {
357 margin-left: 2em;
358 font-size: 0.9em;
359}
360div.toclevel3 {
361 margin-left: 4em;
362 font-size: 0.9em;
363}
364div.toclevel4 {
365 margin-left: 6em;
366 font-size: 0.9em;
367}
Junio C Hamano3dac5042007-12-15 08:40:54368
Junio C Hamano9d971152012-12-19 00:43:11369span.aqua { color: aqua; }
370span.black { color: black; }
371span.blue { color: blue; }
372span.fuchsia { color: fuchsia; }
373span.gray { color: gray; }
374span.green { color: green; }
375span.lime { color: lime; }
376span.maroon { color: maroon; }
377span.navy { color: navy; }
378span.olive { color: olive; }
379span.purple { color: purple; }
380span.red { color: red; }
381span.silver { color: silver; }
382span.teal { color: teal; }
383span.white { color: white; }
384span.yellow { color: yellow; }
385
386span.aqua-background { background: aqua; }
387span.black-background { background: black; }
388span.blue-background { background: blue; }
389span.fuchsia-background { background: fuchsia; }
390span.gray-background { background: gray; }
391span.green-background { background: green; }
392span.lime-background { background: lime; }
393span.maroon-background { background: maroon; }
394span.navy-background { background: navy; }
395span.olive-background { background: olive; }
396span.purple-background { background: purple; }
397span.red-background { background: red; }
398span.silver-background { background: silver; }
399span.teal-background { background: teal; }
400span.white-background { background: white; }
401span.yellow-background { background: yellow; }
402
403span.big { font-size: 2em; }
404span.small { font-size: 0.6em; }
405
406span.underline { text-decoration: underline; }
407span.overline { text-decoration: overline; }
408span.line-through { text-decoration: line-through; }
409
Junio C Hamano9d971152012-12-19 00:43:11410
411/*
412 * xhtml11 specific
413 *
414 * */
415
Junio C Hamano61525f92014-01-17 22:46:49416tt {
417 font-family: monospace;
418 font-size: inherit;
419 color: navy;
420}
421
Junio C Hamano9d971152012-12-19 00:43:11422div.tableblock {
423 margin-top: 1.0em;
424 margin-bottom: 1.5em;
Junio C Hamano3dac5042007-12-15 08:40:54425}
Junio C Hamano9d971152012-12-19 00:43:11426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
Junio C Hamano3dac5042007-12-15 08:40:54430 font-weight: bold;
Junio C Hamano9d971152012-12-19 00:43:11431 color: #527bbd;
432}
433p.table {
434 margin-top: 0;
435}
436/* Because the table frame attribute is overriden by CSS in most browsers. */
437div.tableblock > table[frame="void"] {
438 border-style: none;
439}
440div.tableblock > table[frame="hsides"] {
441 border-left-style: none;
442 border-right-style: none;
443}
444div.tableblock > table[frame="vsides"] {
445 border-top-style: none;
446 border-bottom-style: none;
Junio C Hamano3dac5042007-12-15 08:40:54447}
448
Junio C Hamano9d971152012-12-19 00:43:11449
450/*
451 * html5 specific
452 *
453 * */
454
Junio C Hamano61525f92014-01-17 22:46:49455.monospaced {
456 font-family: monospace;
457 font-size: inherit;
458 color: navy;
459}
460
Junio C Hamano9d971152012-12-19 00:43:11461table.tableblock {
462 margin-top: 1.0em;
463 margin-bottom: 1.5em;
464}
465thead, p.tableblock.header {
466 font-weight: bold;
467 color: #527bbd;
468}
469p.tableblock {
470 margin-top: 0;
471}
472table.tableblock {
473 border-width: 3px;
474 border-spacing: 0px;
475 border-style: solid;
476 border-color: #527bbd;
477 border-collapse: collapse;
478}
479th.tableblock, td.tableblock {
480 border-width: 1px;
481 padding: 4px;
482 border-style: solid;
483 border-color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:54484}
485
Junio C Hamano9d971152012-12-19 00:43:11486table.tableblock.frame-topbot {
487 border-left-style: hidden;
488 border-right-style: hidden;
489}
490table.tableblock.frame-sides {
491 border-top-style: hidden;
492 border-bottom-style: hidden;
493}
494table.tableblock.frame-none {
495 border-style: hidden;
496}
497
498th.tableblock.halign-left, td.tableblock.halign-left {
499 text-align: left;
500}
501th.tableblock.halign-center, td.tableblock.halign-center {
502 text-align: center;
503}
504th.tableblock.halign-right, td.tableblock.halign-right {
Junio C Hamano103b5722011-01-31 05:03:45505 text-align: right;
506}
507
Junio C Hamano9d971152012-12-19 00:43:11508th.tableblock.valign-top, td.tableblock.valign-top {
509 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45510}
Junio C Hamano9d971152012-12-19 00:43:11511th.tableblock.valign-middle, td.tableblock.valign-middle {
512 vertical-align: middle;
513}
514th.tableblock.valign-bottom, td.tableblock.valign-bottom {
515 vertical-align: bottom;
Junio C Hamano3dac5042007-12-15 08:40:54516}
517
Junio C Hamano9d971152012-12-19 00:43:11518
519/*
520 * manpage specific
521 *
522 * */
523
524body.manpage h1 {
525 padding-top: 0.5em;
526 padding-bottom: 0.5em;
527 border-top: 2px solid silver;
528 border-bottom: 2px solid silver;
529}
530body.manpage h2 {
531 border-style: none;
532}
533body.manpage div.sectionbody {
534 margin-left: 3em;
Junio C Hamano3dac5042007-12-15 08:40:54535}
Junio C Hamano915cd9b2008-07-20 01:24:17536
Junio C Hamano9d971152012-12-19 00:43:11537@media print {
538 body.manpage div#toc { display: none; }
539}
Junio C Hamano3dac5042007-12-15 08:40:54540</style>
Junio C Hamano7bd050f2011-09-22 06:32:22541<script type="text/javascript">
542/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22543var asciidoc = { // Namespace.
544
545/////////////////////////////////////////////////////////////////////
546// Table Of Contents generator
547/////////////////////////////////////////////////////////////////////
548
549/* Author: Mihai Bazon, September 2002
550 * http://students.infoiasi.ro/~mishoo
551 *
552 * Table Of Content generator
553 * Version: 0.4
554 *
555 * Feel free to use this script under the terms of the GNU General Public
556 * License, as long as you do not remove or alter this notice.
557 */
558
559 /* modified by Troy D. Hanson, September 2006. License: GPL */
560 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561
562// toclevels = 1..4.
563toc: function (toclevels) {
564
565 function getText(el) {
566 var text = "";
567 for (var i = el.firstChild; i != null; i = i.nextSibling) {
568 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 text += i.data;
570 else if (i.firstChild != null)
571 text += getText(i);
572 }
573 return text;
574 }
575
576 function TocEntry(el, text, toclevel) {
577 this.element = el;
578 this.text = text;
579 this.toclevel = toclevel;
580 }
581
582 function tocEntries(el, toclevels) {
583 var result = new Array;
Junio C Hamano61525f92014-01-17 22:46:49584 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22585 // Function that scans the DOM tree for header elements (the DOM2
586 // nodeIterator API would be a better technique but not supported by all
587 // browsers).
588 var iterate = function (el) {
589 for (var i = el.firstChild; i != null; i = i.nextSibling) {
590 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
591 var mo = re.exec(i.tagName);
592 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
593 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 }
595 iterate(i);
596 }
597 }
598 }
599 iterate(el);
600 return result;
601 }
602
603 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11604 if (!toc) {
605 return;
606 }
607
608 // Delete existing TOC entries in case we're reloading the TOC.
609 var tocEntriesToRemove = [];
610 var i;
611 for (i = 0; i < toc.childNodes.length; i++) {
612 var entry = toc.childNodes[i];
Junio C Hamano61525f92014-01-17 22:46:49613 if (entry.nodeName == 'div'
Junio C Hamano9d971152012-12-19 00:43:11614 && entry.getAttribute("class")
615 && entry.getAttribute("class").match(/^toclevel/))
616 tocEntriesToRemove.push(entry);
617 }
618 for (i = 0; i < tocEntriesToRemove.length; i++) {
619 toc.removeChild(tocEntriesToRemove[i]);
620 }
621
622 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22623 var entries = tocEntries(document.getElementById("content"), toclevels);
624 for (var i = 0; i < entries.length; ++i) {
625 var entry = entries[i];
626 if (entry.element.id == "")
627 entry.element.id = "_toc_" + i;
628 var a = document.createElement("a");
629 a.href = "#" + entry.element.id;
630 a.appendChild(document.createTextNode(entry.text));
631 var div = document.createElement("div");
632 div.appendChild(a);
633 div.className = "toclevel" + entry.toclevel;
634 toc.appendChild(div);
635 }
636 if (entries.length == 0)
637 toc.parentNode.removeChild(toc);
638},
639
640
641/////////////////////////////////////////////////////////////////////
642// Footnotes generator
643/////////////////////////////////////////////////////////////////////
644
645/* Based on footnote generation code from:
646 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
647 */
648
649footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11650 // Delete existing footnote entries in case we're reloading the footnodes.
651 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22652 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11653 if (!noteholder) {
654 return;
655 }
656 var entriesToRemove = [];
657 for (i = 0; i < noteholder.childNodes.length; i++) {
658 var entry = noteholder.childNodes[i];
Junio C Hamano61525f92014-01-17 22:46:49659 if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11660 entriesToRemove.push(entry);
661 }
662 for (i = 0; i < entriesToRemove.length; i++) {
663 noteholder.removeChild(entriesToRemove[i]);
664 }
665
666 // Rebuild footnote entries.
667 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22668 var spans = cont.getElementsByTagName("span");
669 var refs = {};
670 var n = 0;
671 for (i=0; i<spans.length; i++) {
672 if (spans[i].className == "footnote") {
673 n++;
Junio C Hamano9d971152012-12-19 00:43:11674 var note = spans[i].getAttribute("data-note");
675 if (!note) {
676 // Use [\s\S] in place of . so multi-line matches work.
677 // Because JavaScript has no s (dotall) regex flag.
678 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
679 spans[i].innerHTML =
680 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
681 "' title='View footnote' class='footnote'>" + n + "</a>]";
682 spans[i].setAttribute("data-note", note);
683 }
Junio C Hamano7bd050f2011-09-22 06:32:22684 noteholder.innerHTML +=
685 "<div class='footnote' id='_footnote_" + n + "'>" +
686 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
687 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22688 var id =spans[i].getAttribute("id");
689 if (id != null) refs["#"+id] = n;
690 }
691 }
692 if (n == 0)
693 noteholder.parentNode.removeChild(noteholder);
694 else {
695 // Process footnoterefs.
696 for (i=0; i<spans.length; i++) {
697 if (spans[i].className == "footnoteref") {
698 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
699 href = href.match(/#.*/)[0]; // Because IE return full URL.
700 n = refs[href];
701 spans[i].innerHTML =
702 "[<a href='#_footnote_" + n +
703 "' title='View footnote' class='footnote'>" + n + "</a>]";
704 }
705 }
706 }
Junio C Hamano9d971152012-12-19 00:43:11707},
708
709install: function(toclevels) {
710 var timerId;
711
712 function reinstall() {
713 asciidoc.footnotes();
714 if (toclevels) {
715 asciidoc.toc(toclevels);
716 }
717 }
718
719 function reinstallAndRemoveTimer() {
720 clearInterval(timerId);
721 reinstall();
722 }
723
724 timerId = setInterval(reinstall, 500);
725 if (document.addEventListener)
726 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
727 else
728 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22729}
730
731}
Junio C Hamano9d971152012-12-19 00:43:11732asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22733/*]]>*/
734</script>
Junio C Hamano3dac5042007-12-15 08:40:54735</head>
Junio C Hamano9d971152012-12-19 00:43:11736<body class="article">
Junio C Hamano3dac5042007-12-15 08:40:54737<div id="header">
738<h1>run-command API</h1>
739</div>
Junio C Hamano7bd050f2011-09-22 06:32:22740<div id="content">
Junio C Hamano3dac5042007-12-15 08:40:54741<div id="preamble">
742<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45743<div class="paragraph"><p>The run-command API offers a versatile tool to run sub-processes with
Junio C Hamano6d559fc2008-02-20 10:44:26744redirected input and output as well as with a modified environment
Junio C Hamano915cd9b2008-07-20 01:24:17745and an alternate current directory.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45746<div class="paragraph"><p>A similar API offers the capability to run a function asynchronously,
Junio C Hamano6d559fc2008-02-20 10:44:26747which is primarily used to capture the output that the function
Junio C Hamano915cd9b2008-07-20 01:24:17748produces in the caller in order to process it.</p></div>
Junio C Hamano6d559fc2008-02-20 10:44:26749</div>
750</div>
Junio C Hamano9d971152012-12-19 00:43:11751<div class="sect1">
Junio C Hamano915cd9b2008-07-20 01:24:17752<h2 id="_functions">Functions</h2>
Junio C Hamano6d559fc2008-02-20 10:44:26753<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45754<div class="dlist"><dl>
755<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49756<tt>start_command</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26757</dt>
758<dd>
759<p>
Junio C Hamano61525f92014-01-17 22:46:49760 Start a sub-process. Takes a pointer to a <tt>struct child_process</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26761 that specifies the details and returns pipe FDs (if requested).
762 See below for details.
763</p>
764</dd>
Junio C Hamano103b5722011-01-31 05:03:45765<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49766<tt>finish_command</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26767</dt>
768<dd>
769<p>
770 Wait for the completion of a sub-process that was started with
771 start_command().
772</p>
773</dd>
Junio C Hamano103b5722011-01-31 05:03:45774<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49775<tt>run_command</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26776</dt>
777<dd>
778<p>
779 A convenience function that encapsulates a sequence of
780 start_command() followed by finish_command(). Takes a pointer
Junio C Hamano61525f92014-01-17 22:46:49781 to a <tt>struct child_process</tt> that specifies the details.
Junio C Hamano6d559fc2008-02-20 10:44:26782</p>
783</dd>
Junio C Hamano103b5722011-01-31 05:03:45784<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49785<tt>run_command_v_opt</tt>, <tt>run_command_v_opt_cd_env</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26786</dt>
787<dd>
788<p>
789 Convenience functions that encapsulate a sequence of
790 start_command() followed by finish_command(). The argument argv
791 specifies the program and its arguments. The argument opt is zero
Junio C Hamano61525f92014-01-17 22:46:49792 or more of the flags <tt>RUN_COMMAND_NO_STDIN</tt>, <tt>RUN_GIT_CMD</tt>,
793 <tt>RUN_COMMAND_STDOUT_TO_STDERR</tt>, or <tt>RUN_SILENT_EXEC_FAILURE</tt>
Junio C Hamano9f883862009-08-11 06:23:52794 that correspond to the members .no_stdin, .git_cmd,
Junio C Hamano61525f92014-01-17 22:46:49795 .stdout_to_stderr, .silent_exec_failure of <tt>struct child_process</tt>.
Junio C Hamano6d559fc2008-02-20 10:44:26796 The argument dir corresponds the member .dir. The argument env
797 corresponds to the member .env.
798</p>
799</dd>
Junio C Hamano9f883862009-08-11 06:23:52800</dl></div>
Junio C Hamano103b5722011-01-31 05:03:45801<div class="paragraph"><p>The functions above do the following:</p></div>
802<div class="olist arabic"><ol class="arabic">
Junio C Hamano9f883862009-08-11 06:23:52803<li>
804<p>
805If a system call failed, errno is set and -1 is returned. A diagnostic
806 is printed.
807</p>
808</li>
809<li>
810<p>
811If the program was not found, then -1 is returned and errno is set to
812 ENOENT; a diagnostic is printed only if .silent_exec_failure is 0.
813</p>
814</li>
815<li>
816<p>
817Otherwise, the program is run. If it terminates regularly, its exit
Junio C Hamano167b1382010-01-31 23:04:31818 code is returned. No diagnostic is printed, even if the exit code is
Junio C Hamano9f883862009-08-11 06:23:52819 non-zero.
820</p>
821</li>
822<li>
823<p>
824If the program terminated due to a signal, then the return value is the
Junio C Hamano7dac6902013-01-12 08:25:31825 signal number + 128, ie. the same value that a POSIX shell&#8217;s $? would
826 report. A diagnostic is printed.
Junio C Hamano9f883862009-08-11 06:23:52827</p>
Junio C Hamano103b5722011-01-31 05:03:45828<div class="dlist"><dl>
829<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49830<tt>start_async</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26831</dt>
832<dd>
833<p>
Junio C Hamano61525f92014-01-17 22:46:49834 Run a function asynchronously. Takes a pointer to a <tt>struct
835 async</tt> that specifies the details and returns a set of pipe FDs
Junio C Hamano74a198f2010-02-22 00:13:31836 for communication with the function. See below for details.
Junio C Hamano6d559fc2008-02-20 10:44:26837</p>
838</dd>
Junio C Hamano103b5722011-01-31 05:03:45839<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49840<tt>finish_async</tt>
Junio C Hamano6d559fc2008-02-20 10:44:26841</dt>
842<dd>
843<p>
Junio C Hamano4f1d8c42008-03-03 02:01:16844 Wait for the completion of an asynchronous function that was
Junio C Hamano6d559fc2008-02-20 10:44:26845 started with start_async().
846</p>
847</dd>
Junio C Hamano103b5722011-01-31 05:03:45848<dt class="hdlist1">
Junio C Hamano61525f92014-01-17 22:46:49849<tt>run_hook</tt>
Junio C Hamanocc0cb312009-01-22 03:38:50850</dt>
851<dd>
852<p>
853 Run a hook.
854 The first argument is a pathname to an index file, or NULL
855 if the hook uses the default index file or no index is needed.
856 The second argument is the name of the hook.
857 The further arguments correspond to the hook arguments.
858 The last argument has to be NULL to terminate the arguments list.
859 If the hook does not exist or is not executable, the return
860 value will be zero.
861 If it is executable, the hook will be executed and the exit
862 status of the hook is returned.
863 On execution, .stdout_to_stderr and .no_stdin will be set.
864 (See below.)
865</p>
866</dd>
Junio C Hamano915cd9b2008-07-20 01:24:17867</dl></div>
Junio C Hamano9f883862009-08-11 06:23:52868</li>
869</ol></div>
Junio C Hamano6d559fc2008-02-20 10:44:26870</div>
Junio C Hamano9d971152012-12-19 00:43:11871</div>
872<div class="sect1">
Junio C Hamano915cd9b2008-07-20 01:24:17873<h2 id="_data_structures">Data structures</h2>
Junio C Hamano6d559fc2008-02-20 10:44:26874<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45875<div class="ulist"><ul>
Junio C Hamano3dac5042007-12-15 08:40:54876<li>
877<p>
Junio C Hamano61525f92014-01-17 22:46:49878<tt>struct child_process</tt>
Junio C Hamano3dac5042007-12-15 08:40:54879</p>
880</li>
Junio C Hamano915cd9b2008-07-20 01:24:17881</ul></div>
Junio C Hamano103b5722011-01-31 05:03:45882<div class="paragraph"><p>This describes the arguments, redirections, and environment of a
Junio C Hamano915cd9b2008-07-20 01:24:17883command to run in a sub-process.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45884<div class="paragraph"><p>The caller:</p></div>
885<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:26886<li>
887<p>
Junio C Hamano7562b872008-06-18 03:17:26888allocates and clears (memset(&amp;chld, 0, sizeof(chld));) a
Junio C Hamano6d559fc2008-02-20 10:44:26889 struct child_process variable;
890</p>
891</li>
892<li>
893<p>
894initializes the members;
895</p>
896</li>
897<li>
898<p>
899calls start_command();
900</p>
901</li>
902<li>
903<p>
904processes the data;
905</p>
906</li>
907<li>
908<p>
909closes file descriptors (if necessary; see below);
910</p>
911</li>
912<li>
913<p>
914calls finish_command().
915</p>
916</li>
Junio C Hamano915cd9b2008-07-20 01:24:17917</ol></div>
Junio C Hamano103b5722011-01-31 05:03:45918<div class="paragraph"><p>The .argv member is set up as an array of string pointers (NULL
Junio C Hamano6d559fc2008-02-20 10:44:26919terminated), of which .argv[0] is the program name to run (usually
920without a path). If the command to run is a git command, set argv[0] to
Junio C Hamano915cd9b2008-07-20 01:24:17921the command name without the <em>git-</em> prefix and set .git_cmd = 1.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45922<div class="paragraph"><p>The members .in, .out, .err are used to redirect stdin, stdout,
Junio C Hamano915cd9b2008-07-20 01:24:17923stderr as follows:</p></div>
Junio C Hamano103b5722011-01-31 05:03:45924<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:26925<li>
926<p>
927Specify 0 to request no special redirection. No new file descriptor
928 is allocated. The child process simply inherits the channel from the
929 parent.
930</p>
931</li>
932<li>
933<p>
934Specify -1 to have a pipe allocated; start_command() replaces -1
935 by the pipe FD in the following way:
936</p>
937<div class="literalblock">
938<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49939<pre><tt>.in: Returns the writable pipe end into which the caller writes;
940 the readable end of the pipe becomes the child's stdin.</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26941</div></div>
942<div class="literalblock">
943<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49944<pre><tt>.out, .err: Returns the readable pipe end from which the caller
Junio C Hamano6d559fc2008-02-20 10:44:26945 reads; the writable end of the pipe end becomes child's
Junio C Hamano61525f92014-01-17 22:46:49946 stdout/stderr.</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26947</div></div>
948<div class="literalblock">
949<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49950<pre><tt>The caller of start_command() must close the so returned FDs
951after it has completed reading from/writing to it!</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26952</div></div>
953</li>
954<li>
955<p>
956Specify a file descriptor &gt; 0 to be used by the child:
957</p>
958<div class="literalblock">
959<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49960<pre><tt>.in: The FD must be readable; it becomes child's stdin.
Junio C Hamano6d559fc2008-02-20 10:44:26961.out: The FD must be writable; it becomes child's stdout.
Junio C Hamano61525f92014-01-17 22:46:49962.err: The FD must be writable; it becomes child's stderr.</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26963</div></div>
964<div class="literalblock">
965<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49966<pre><tt>The specified FD is closed by start_command(), even if it fails to
967run the sub-process!</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26968</div></div>
969</li>
970<li>
971<p>
972Special forms of redirection are available by setting these members
973 to 1:
974</p>
975<div class="literalblock">
976<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49977<pre><tt>.no_stdin, .no_stdout, .no_stderr: The respective channel is
978 redirected to /dev/null.</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26979</div></div>
980<div class="literalblock">
981<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49982<pre><tt>.stdout_to_stderr: stdout of the child is redirected to its
Junio C Hamano86bcccc2008-03-08 09:33:55983 stderr. This happens after stderr is itself redirected.
984 So stdout will follow stderr to wherever it is
Junio C Hamano61525f92014-01-17 22:46:49985 redirected.</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:26986</div></div>
987</li>
Junio C Hamano915cd9b2008-07-20 01:24:17988</ol></div>
Junio C Hamano103b5722011-01-31 05:03:45989<div class="paragraph"><p>To modify the environment of the sub-process, specify an array of
Junio C Hamano915cd9b2008-07-20 01:24:17990string pointers (NULL terminated) in .env:</p></div>
Junio C Hamano103b5722011-01-31 05:03:45991<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:26992<li>
993<p>
994If the string is of the form "VAR=value", i.e. it contains <em>=</em>
Junio C Hamano103b5722011-01-31 05:03:45995 the variable is added to the child process&#8217;s environment.
Junio C Hamano6d559fc2008-02-20 10:44:26996</p>
997</li>
998<li>
999<p>
Junio C Hamano4f1d8c42008-03-03 02:01:161000If the string does not contain <em>=</em>, it names an environment
Junio C Hamano103b5722011-01-31 05:03:451001 variable that will be removed from the child process&#8217;s environment.
Junio C Hamano6d559fc2008-02-20 10:44:261002</p>
1003</li>
Junio C Hamano915cd9b2008-07-20 01:24:171004</ol></div>
Junio C Hamano103b5722011-01-31 05:03:451005<div class="paragraph"><p>To specify a new initial working directory for the sub-process,
Junio C Hamano915cd9b2008-07-20 01:24:171006specify it in the .dir member.</p></div>
Junio C Hamano103b5722011-01-31 05:03:451007<div class="paragraph"><p>If the program cannot be found, the functions return -1 and set
Junio C Hamano9f883862009-08-11 06:23:521008errno to ENOENT. Normally, an error message is printed, but if
1009.silent_exec_failure is set to 1, no message is printed for this
1010special error condition.</p></div>
Junio C Hamano103b5722011-01-31 05:03:451011<div class="ulist"><ul>
Junio C Hamano6d559fc2008-02-20 10:44:261012<li>
1013<p>
Junio C Hamano61525f92014-01-17 22:46:491014<tt>struct async</tt>
Junio C Hamano6d559fc2008-02-20 10:44:261015</p>
1016</li>
Junio C Hamano915cd9b2008-07-20 01:24:171017</ul></div>
Junio C Hamano103b5722011-01-31 05:03:451018<div class="paragraph"><p>This describes a function to run asynchronously, whose purpose is
Junio C Hamano915cd9b2008-07-20 01:24:171019to produce output that the caller reads.</p></div>
Junio C Hamano103b5722011-01-31 05:03:451020<div class="paragraph"><p>The caller:</p></div>
1021<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:261022<li>
1023<p>
Junio C Hamano7562b872008-06-18 03:17:261024allocates and clears (memset(&amp;asy, 0, sizeof(asy));) a
Junio C Hamano6d559fc2008-02-20 10:44:261025 struct async variable;
1026</p>
1027</li>
1028<li>
1029<p>
1030initializes .proc and .data;
1031</p>
1032</li>
1033<li>
1034<p>
1035calls start_async();
1036</p>
1037</li>
1038<li>
1039<p>
Junio C Hamano74a198f2010-02-22 00:13:311040processes communicates with proc through .in and .out;
Junio C Hamano6d559fc2008-02-20 10:44:261041</p>
1042</li>
1043<li>
1044<p>
Junio C Hamano74a198f2010-02-22 00:13:311045closes .in and .out;
Junio C Hamano6d559fc2008-02-20 10:44:261046</p>
1047</li>
1048<li>
1049<p>
1050calls finish_async().
1051</p>
1052</li>
Junio C Hamano915cd9b2008-07-20 01:24:171053</ol></div>
Junio C Hamano103b5722011-01-31 05:03:451054<div class="paragraph"><p>The members .in, .out are used to provide a set of fd&#8217;s for
Junio C Hamano74a198f2010-02-22 00:13:311055communication between the caller and the callee as follows:</p></div>
Junio C Hamano103b5722011-01-31 05:03:451056<div class="olist arabic"><ol class="arabic">
Junio C Hamano74a198f2010-02-22 00:13:311057<li>
1058<p>
1059Specify 0 to have no file descriptor passed. The callee will
1060 receive -1 in the corresponding argument.
1061</p>
1062</li>
1063<li>
1064<p>
1065Specify &lt; 0 to have a pipe allocated; start_async() replaces
1066 with the pipe FD in the following way:
1067</p>
1068<div class="literalblock">
1069<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491070<pre><tt>.in: Returns the writable pipe end into which the caller
Junio C Hamano74a198f2010-02-22 00:13:311071writes; the readable end of the pipe becomes the function's
Junio C Hamano61525f92014-01-17 22:46:491072in argument.</tt></pre>
Junio C Hamano74a198f2010-02-22 00:13:311073</div></div>
1074<div class="literalblock">
1075<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491076<pre><tt>.out: Returns the readable pipe end from which the caller
Junio C Hamano74a198f2010-02-22 00:13:311077reads; the writable end of the pipe becomes the function's
Junio C Hamano61525f92014-01-17 22:46:491078out argument.</tt></pre>
Junio C Hamano74a198f2010-02-22 00:13:311079</div></div>
1080<div class="literalblock">
1081<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491082<pre><tt>The caller of start_async() must close the returned FDs after it
1083has completed reading from/writing from them.</tt></pre>
Junio C Hamano74a198f2010-02-22 00:13:311084</div></div>
1085</li>
1086<li>
1087<p>
1088Specify a file descriptor &gt; 0 to be used by the function:
1089</p>
1090<div class="literalblock">
1091<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491092<pre><tt>.in: The FD must be readable; it becomes the function's in.
1093.out: The FD must be writable; it becomes the function's out.</tt></pre>
Junio C Hamano74a198f2010-02-22 00:13:311094</div></div>
1095<div class="literalblock">
1096<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491097<pre><tt>The specified FD is closed by start_async(), even if it fails to
1098run the function.</tt></pre>
Junio C Hamano74a198f2010-02-22 00:13:311099</div></div>
1100</li>
1101</ol></div>
Junio C Hamano103b5722011-01-31 05:03:451102<div class="paragraph"><p>The function pointer in .proc has the following signature:</p></div>
Junio C Hamano6d559fc2008-02-20 10:44:261103<div class="literalblock">
1104<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491105<pre><tt>int proc(int in, int out, void *data);</tt></pre>
Junio C Hamano6d559fc2008-02-20 10:44:261106</div></div>
Junio C Hamano103b5722011-01-31 05:03:451107<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:261108<li>
1109<p>
Junio C Hamano74a198f2010-02-22 00:13:311110in, out specifies a set of file descriptors to which the function
1111 must read/write the data that it needs/produces. The function
1112 <strong>must</strong> close these descriptors before it returns. A descriptor
1113 may be -1 if the caller did not configure a descriptor for that
1114 direction.
Junio C Hamano6d559fc2008-02-20 10:44:261115</p>
1116</li>
1117<li>
1118<p>
1119data is the value that the caller has specified in the .data member
1120 of struct async.
1121</p>
1122</li>
1123<li>
1124<p>
1125The return value of the function is 0 on success and non-zero
1126 on failure. If the function indicates failure, finish_async() will
1127 report failure as well.
1128</p>
1129</li>
Junio C Hamano915cd9b2008-07-20 01:24:171130</ol></div>
Junio C Hamano103b5722011-01-31 05:03:451131<div class="paragraph"><p>There are serious restrictions on what the asynchronous function can do
Junio C Hamanobb88cf42010-06-21 15:23:551132because this facility is implemented by a thread in the same address
1133space on most platforms (when pthreads is available), but by a pipe to
1134a forked process otherwise:</p></div>
Junio C Hamano103b5722011-01-31 05:03:451135<div class="olist arabic"><ol class="arabic">
Junio C Hamano6d559fc2008-02-20 10:44:261136<li>
1137<p>
Junio C Hamano103b5722011-01-31 05:03:451138It cannot change the program&#8217;s state (global variables, environment,
Junio C Hamano74a198f2010-02-22 00:13:311139 etc.) in a way that the caller notices; in other words, .in and .out
1140 are the only communication channels to the caller.
Junio C Hamano6d559fc2008-02-20 10:44:261141</p>
1142</li>
1143<li>
1144<p>
Junio C Hamano103b5722011-01-31 05:03:451145It must not change the program&#8217;s state that the caller of the
Junio C Hamano6d559fc2008-02-20 10:44:261146 facility also uses.
1147</p>
1148</li>
Junio C Hamano915cd9b2008-07-20 01:24:171149</ol></div>
Junio C Hamano3dac5042007-12-15 08:40:541150</div>
Junio C Hamano7bd050f2011-09-22 06:32:221151</div>
Junio C Hamano9d971152012-12-19 00:43:111152</div>
Junio C Hamano7bd050f2011-09-22 06:32:221153<div id="footnotes"><hr /></div>
Junio C Hamano3dac5042007-12-15 08:40:541154<div id="footer">
1155<div id="footer-text">
Junio C Hamano683a8612013-08-23 20:50:091156Last updated 2013-08-20 08:40:27 PDT
Junio C Hamano3dac5042007-12-15 08:40:541157</div>
1158</div>
1159</body>
1160</html>