Skip to content

[New Feature] Gracefully handle carriage returns #23

Description

@JavaScriptDude

Many programs utilize carriage return in the output updates to the console without pushing a new line. It would be sweet if python-shell could handle these gracefully and fire a new event like 'crdata' so the consumer can gracefully handle these line updates.

stream-splitter seems like a good module that can help to accomplish this: https://github.com/samcday/node-stream-splitter

Thanks for this cool tool!

Activity

  1. extrabacon commented on Dec 17, 2015

    @extrabacon
    Owner

    A transform stream sure is nice but I think it would be unnecessarily complex. We could easily make the message splitting more flexible by allowing to set the ending characters in the options. See: https://github.com/extrabacon/python-shell/blob/master/index.js#L200

  2. JavaScriptDude commented on Dec 17, 2015

    @JavaScriptDude
    Author

    I tried that last night but it does not give sense of progress when watching the output which is my goal; as the Python script sends \r chars, I want that line immediately so I can update my UI and pass the progress update.

    Therefore I think it needs to be done further up the stdout processing chain.

    On December 17, 2015 9:22:00 AM EST, Nicolas Mercier notifications@github.com wrote:

    A transform stream sure is nice but I think it would be unnecessarily
    complex. We could easily make the message splitting more flexible by
    allowing to set the ending characters in the options. See:
    https://github.com/extrabacon/python-shell/blob/master/index.js#L200


    Reply to this email directly or view it on GitHub:
    #23 (comment)

    Sent from my Android device with K-9 Mail. Please excuse my brevity.

  3. extrabacon commented on Dec 17, 2015

    @extrabacon
    Owner

    Sounds like a buffering issue. Stdin and stdout are buffered by default and you need to flush in order to "update immediately".

  4. JavaScriptDude commented on Dec 18, 2015

    @JavaScriptDude
    Author

    I agree. It should be possible to accomplish this and it would be a pretty cool feature IMO.

    Thanks for putting some thought into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions