{"thread":{"id":"20487","subject":"[PATCH js/run-command-updates] api-run-command.txt: describe error behavior of run_command functions","startedAt":"2009-08-08T20:44:20Z","lastAt":"2009-08-08T20:53:35Z","messageCount":2,"participants":["Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"120014","messageId":"200908082244.20476.j6t@kdbg.org","threadId":"20487","inReplyTo":null,"subject":"[PATCH js/run-command-updates] api-run-command.txt: describe error behavior of run_command functions","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-08-08T20:44:20Z","receivedAt":"2009-08-08T20:44:20Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n Documentation/technical/api-run-command.txt |   31 ++++++++++++++++++++++++--\n 1 files changed, 28 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/technical/api-run-command.txt \nb/Documentation/technical/api-run-command.txt\nindex 2efe7a4..b26c281 100644\n--- a/Documentation/technical/api-run-command.txt\n+++ b/Documentation/technical/api-run-command.txt\n@@ -35,12 +35,32 @@ Functions\n \tConvenience functions that encapsulate a sequence of\n \tstart_command() followed by finish_command(). The argument argv\n \tspecifies the program and its arguments. The argument opt is zero\n-\tor more of the flags `RUN_COMMAND_NO_STDIN`, `RUN_GIT_CMD`, or\n-\t`RUN_COMMAND_STDOUT_TO_STDERR` that correspond to the members\n-\t.no_stdin, .git_cmd, .stdout_to_stderr of `struct child_process`.\n+\tor more of the flags `RUN_COMMAND_NO_STDIN`, `RUN_GIT_CMD`,\n+\t`RUN_COMMAND_STDOUT_TO_STDERR`, or `RUN_SILENT_EXEC_FAILURE`\n+\tthat correspond to the members .no_stdin, .git_cmd,\n+\t.stdout_to_stderr, .silent_exec_failure of `struct child_process`.\n \tThe argument dir corresponds the member .dir. The argument env\n \tcorresponds to the member .env.\n \n+The functions above do the following:\n+\n+. If a system call failed, errno is set and -1 is returned. A diagnostic\n+  is printed.\n+\n+. If the program was not found, then -1 is returned and errno is set to\n+  ENOENT; a diagnostic is printed only if .silent_exec_failure is 0.\n+\n+. Otherwise, the program is run. If it terminates regularly, its exit\n+  code is returned. No diagnistic is printed, even if the exit code is\n+  non-zero.\n+\n+. If the program terminated due to a signal, then the return value is the\n+  signal number - 128, ie. it is negative and so indicates an unusual\n+  condition; a diagnostic is printed. This return value can be passed to\n+  exit(2), which will report the same code to the parent process that a\n+  POSIX shell's $? would report for a program that died from the signal.\n+\n+\n `start_async`::\n \n \tRun a function asynchronously. Takes a pointer to a `struct\n@@ -143,6 +163,11 @@ string pointers (NULL terminated) in .env:\n To specify a new initial working directory for the sub-process,\n specify it in the .dir member.\n \n+If the program cannot be found, the functions return -1 and set\n+errno to ENOENT. Normally, an error message is printed, but if\n+.silent_exec_failure is set to 1, no message is printed for this\n+special error condition.\n+\n \n * `struct async`\n \n-- \n1.6.4.87.g9ec6e\n"},{"id":"120015","messageId":"7vab2ac9io.fsf@alter.siamese.dyndns.org","threadId":"20487","inReplyTo":"200908082244.20476.j6t@kdbg.org","subject":"Re: [PATCH js/run-command-updates] api-run-command.txt: describe error behavior of run_command functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-08T20:53:35Z","receivedAt":"2009-08-08T20:53:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  Documentation/technical/api-run-command.txt |   31 ++++++++++++++++++++++++--\n>  1 files changed, 28 insertions(+), 3 deletions(-)\n\nThanks.\n"}]}