Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to capture and distinguish between stderr and stdout #14

Closed
ssbarnea opened this issue Jul 18, 2018 · 3 comments
Closed

ability to capture and distinguish between stderr and stdout #14

ssbarnea opened this issue Jul 18, 2018 · 3 comments

Comments

@ssbarnea
Copy link

Most applications do output to both stdout and stderr and it maybe extremely useful if seashells would be able to capture both and also to differentiate between them.

Example:

ccxc cxc | seashells                                                                                                                                                                                                            zsh: command not found: ccxc
serving at https://seashells.io/v/XBQADDt4

As seen the url contains no output because the entire output was on stderr.

I know that by redirecting stderr to stdout via 2>&1 i can assure that both endup printed.

Still this is not the same as capturing stderr and stdout separated and it would make impossible to distinguish between them.

Still, i seashells would execute the commands itself this would be possible, with a syntax like seashells -c "xxxdfdf d" the app would be able to fully control the stderr and stdin.

@anishathalye
Copy link
Owner

Hmm, this is an interesting idea.

A terminal output in general does not distinguish between how stdout and stderr are displayed, so it might be confusing if seashells somehow distinguishes between the two. How would you imagine the output being differentiated in the Seashells web interface?

I'd prefer to avoid adding additional complexity to Seashells; this feature would require changes to the client, the client-server protocol (to distinguish the two streams), and the web frontend, so it would be a pretty big change.

And if stdout and stderr can just be merged rather than being displayed distinctly, the standard 2>&1 achieves what we want, so it doesn't seem worthwhile to add complexity to Seashells to launch programs and capture their output.

@ssbarnea
Copy link
Author

Special treatment for stderr would clearly not be easy to implement, lets keep this a different feature request.

Still ability to easily start a command would be extremely beneficial because it is just too easy (and harder) to forget to type the 2>&1 on each invocation.

Thus is why I propose alternative use as a "prefix" (launcher). If you want it can also be another executable. Use of shell aliases does not work in this case but I was able to create a shell function that does the trick:

function sea() {
    $* 2>&1 | seashells;
}

And now I can just do sea df instead of df 2>&1 | seashells, saving a lot of keystrokes.

@anishathalye
Copy link
Owner

Good point. I added a section to the readme about this: https://github.com/anishathalye/seashells#tips-and-tricks

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

No branches or pull requests

2 participants