From bb996253cec57495723701ed32facbe29e7ad0f3 Mon Sep 17 00:00:00 2001 From: portix Date: Thu, 20 Dec 2012 12:00:25 +0100 Subject: Return a deferred from system.spawn --- api/dwb-js.7 | 24 ++++-------------------- api/jsapi.7.txt | 20 ++++---------------- api/jsapi.txt | 21 ++++----------------- 3 files changed, 12 insertions(+), 53 deletions(-) (limited to 'api') diff --git a/api/dwb-js.7 b/api/dwb-js.7 index a614259a..2a12e950 100644 --- a/api/dwb-js.7 +++ b/api/dwb-js.7 @@ -2,12 +2,12 @@ .\" Title: dwb-js .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.77.1 -.\" Date: 12/19/2012 +.\" Date: 12/20/2012 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB\-JS" "7" "12/19/2012" "\ \&" "\ \&" +.TH "DWB\-JS" "7" "12/20/2012" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -808,7 +808,7 @@ true if creation was successful or directory already existed .nr an-break-flag 1 .br .ps +1 -\fBSpawnError system.spawn(String command, [Function stdin], [Function stderr])\fR +\fBDeferred system.spawn(String command, [Function stdin], [Function stderr])\fR .RS 4 .sp Executes a shell command using the default search path @@ -830,7 +830,7 @@ Callback function for stderr, optional .PP \fIreturns\fR .RS 4 -SpawnError if an error occured, 0 otherwise +A deferred, it will be resolved if the child exits normally, it will be rejected if the child process exits abnormally, the first parameter of the reject function will be the status code of the child process\&. .RE .RE .sp @@ -3107,22 +3107,6 @@ const NavigationReason = { .if n \{\ .RE .\} -.SS "SpawnError" -.sp -.if n \{\ -.RS 4 -.\} -.nf -const SpawnError = { - success : 0, - spawnFailed : 1<<0, - stdoutFailed : 1<<1, - stderrFailed : 1<<2 -}; -.fi -.if n \{\ -.RE -.\} .SS "Modes" .sp .if n \{\ diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt index 090865da..3bfbf883 100644 --- a/api/jsapi.7.txt +++ b/api/jsapi.7.txt @@ -368,7 +368,7 @@ _mode_;; The permissions the directory will get _returns_;; true if creation was successful or directory already existed **** -==== SpawnError system.spawn(String command, [Function stdin], [Function stderr]) +==== Deferred system.spawn(String command, [Function stdin], [Function stderr]) **** Executes a shell command using the default search path @@ -377,7 +377,9 @@ _command_;; The command to execute _stdin(String)_;; Callback function for stdin, pass null if only stderr is needed, optional _stderr(String)_;; Callback function for stderr, optional -_returns_;; SpawnError if an error occured, 0 otherwise +_returns_;; A deferred, it will be resolved if the child exits +normally, it will be rejected if the child process exits abnormally, the first +parameter of the reject function will be the status code of the child process. **** ==== Object system.spawnSync(String command) @@ -1541,20 +1543,6 @@ const NavigationReason = { -------- **** -=== SpawnError - -**** -[source,javascript] --------- -const SpawnError = { - success : 0, - spawnFailed : 1<<0, - stdoutFailed : 1<<1, - stderrFailed : 1<<2 -}; --------- -**** - === Modes **** diff --git a/api/jsapi.txt b/api/jsapi.txt index 4355af15..f6122dde 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -630,7 +630,7 @@ _returns_;; +true+ if creation was successful or directory already existed [source,javascript] ---- -SpawnError system.spawn(String command, [Function stdin], [Function stderr]) +Deferred system.spawn(String command, [Function stdin], [Function stderr]) ---- Executes a shell command using the default search path @@ -641,7 +641,9 @@ _command_;; The command to execute _stdin(String)_;; Callback function for stdin, pass +null+ if only stderr is needed, optional _stderr(String)_;; Callback function for stderr, optional -_returns_;; <> if an error occured, 0 otherwise +_returns_;; A deferred, it will be resolved if the child exits +normally, it will be rejected if the child process exits abnormally, the first +parameter of the reject function will be the status code of the child process. **** **** @@ -2733,21 +2735,6 @@ const NavigationReason = { -------- **** -**** -[[SpawnError]] -[float] -==== *SpawnError* ==== -[source,javascript] --------- -const SpawnError = { - success : 0, - spawnFailed : 1<<0, - stdoutFailed : 1<<1, - stderrFailed : 1<<2 -}; --------- -**** - **** [[Modes]] [float] -- cgit v1.2.3