In Erlang, how can I independently capture stdout and stderr of a subprocess?

Vultaire

I'm trying to figure out how to pull the stdout and stderr from a system subprocess in Erlang. (Not to be confused with an Erlang process.) The gotcha is I'm trying to pull the output of the streams independently.

open_port/2 seems to get me most of the way there, however it doesn't seem to provide a way to differentiate between the two streams. There is the stderr_to_stdout option, but that's not what I want; I want to get data from both data streams but be able to distinguish the two streams.

Any suggestions? Thanks.

Update: I'm ideally looking for a solution that will work on both Windows and Linux.

Steve Vinoski

You may want to try erlexec. As its documentation explains, it allows separate control over stdout and stderr, and in general it's much more flexible than open_port/2 for managing OS processes from Erlang.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how do i test subprocess's stdout, stderr in python on windows

How can I capture stdout/stderr in a file but still see it in my console?

How can I capture stdout and stderr output from a process with Haskell turtle?

How can I pipe stderr, and not stdout?

How can I redirect stdout and stderr with variant?

How do i capture interleaved stdout and stderr in a goloang ssh session?

How can I read stderr with python if I'm NOT using subprocess?

Redirect subprocess stderr to stdout

Redirect subprocess stderr to stdout

In PowerShell, how can I get stdout and stderr from a native command interleave correctly when redirecting stderr to stdout?

How to capture stdout, stderr and $? temporarily in bash

Python: How to capture the stdout/stderr of a unittest in a variable?

how to properly capture all stdout/stderr

How to capture stderr in a variable and pipe stdout through

How to capture python subprocess stdout in unittest

How do I stream a subprocess's stderr while returning stdout as string?

How can I convert to uppercase stderr output but not stdout?

How can I view stdout/stderr of a startup application?

How do I log to stdout or stderr from an Erlang common test suite?

stdout and stderr capture with capsys

I want to get both stdout and stderr from subprocess

How can I start a subprocess in Python that runs independently and continues running if the main process is closed?

How to read stdout and stderr and save it all at once with subprocess Popen?

How to run Python subprocess and stream but also filter stdout and stderr?

How to interact with a subprocess through its stdin, stdout, stderr in Smalltalk?

How to mock returncode, stdout, stderr from subprocess.run with pytest?

Watch stdout and stderr of a subprocess simultaneously

Python subprocess supress stdout and stderr

Perl catching STDERR and STDOUT of subprocess

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive