You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by vladimir-kotikov <gi...@git.apache.org> on 2016/02/01 14:16:39 UTC

[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-lib/pull/369

    CB-10052 Expose child process' io streams via promise progress notification

    This implements [CB-10052](https://issues.apache.org/jira/browse/CB-10052).
    
    The `superspawn.spawn` promise now emits notifications, which caller can subscribe to using `progress` method:
    
    ```
    superspawn.spawn('adb', ['devices'])
    .progress(function(data){
        if (data.stderr) console.error('"adb devices" raised an error: ' + data.stderr);
    })
    .then(function(devices){
        // Do something...
    })
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-lib CB-10052

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/369.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #369
    
----
commit 5a37978e9aeeeda4f71e876299fce4358f4ed2fd
Author: Vladimir Kotikov <v-...@microsoft.com>
Date:   2016-01-22T13:39:13Z

    CB-10052 Expose child process' io streams via promise progress notification

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178520650
  
    @dblotsky, it seems that didn't really understand your idea. Could you please clarify, where do you propose to return `stdout` and `stderr` from?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-lib/pull/369


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/369#discussion_r51532148
  
    --- Diff: cordova-common/src/superspawn.js ---
    @@ -113,11 +139,15 @@ exports.spawn = function(cmd, args, opts) {
             child.stdout.setEncoding('utf8');
             child.stdout.on('data', function(data) {
                 capturedOut += data;
    +            d.notify({'stdout': data});
    --- End diff --
    
    `d` is a `Deferred` object. See https://github.com/apache/cordova-lib/blob/master/cordova-common/src/superspawn.js#L68


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178512699
  
    @vladimir-kotikov you still need to subscribe a callback, just using `progress` instead of `on("data")`. However using `progress` creates a *new* API, while using `on` leverages a well-established existing API. I'd recommend just reusing what's already known by users of Node APIs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178421841
  
    Returning data instead of raw eventEmitter is IMO just less complex for caller API, because you, as a caller, do not need to create handlers, subscribe, unsubscribe, etc.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178526013
  
    Ah, it seems like I'm the one that's confused. I didn't know that `progress` was a standard promise function. Returning `child` is what I meant, but that would basically require us to stop using promises. I see how this works now: please disregard my comment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/369#discussion_r51511432
  
    --- Diff: cordova-common/src/superspawn.js ---
    @@ -113,11 +139,15 @@ exports.spawn = function(cmd, args, opts) {
             child.stdout.setEncoding('utf8');
             child.stdout.on('data', function(data) {
                 capturedOut += data;
    +            d.notify({'stdout': data});
    --- End diff --
    
    What is `d`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178885626
  
    Yep, LGTM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178564407
  
    @dblotsky, is this good to go?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-lib pull request: CB-10052 Expose child process' io stream...

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on the pull request:

    https://github.com/apache/cordova-lib/pull/369#issuecomment-178308498
  
    Why not return the stdout and stderr objects on which calling code can subscribe to the `"data"` events directly?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org