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

Add --pipe option to nngcat #1423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add --pipe option to nngcat #1423

wants to merge 1 commit into from

Conversation

thejoelw
Copy link

@thejoelw thejoelw commented Feb 4, 2021

It would be nice for nngcat to be able to send a stream of data from a unix pipe (stdin or a named pipe file). This is impossible to do with the existing --file option, which reads the data into memory, then sends it one or more times. With the proposed --pipe option, each line from the specified pipe is sent as a message. This is more similar to how the nc and socat utilities function.


int rv;
nng_msg * msg;
char * line = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor indenting error. We use indents by tab, where the tab is 8 cells wide. Please see our .clang-format.

@gdamore
Copy link
Contributor

gdamore commented Feb 7, 2021

This PR is unfortunately port portable (see the windows failures).

May consider converting it to use stdio (which is supported under all ANSI C platforms, including Windows.)

@dch
Copy link

dch commented Feb 28, 2021

this is a very nice feature - thanks!

Copy link
Contributor

@gdamore gdamore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be converted to use fgets() or something portable in lieu of getline().

And I'd appreciate it if you could run this through clang-format.

@wishdev
Copy link

wishdev commented Mar 17, 2024

I took the original commit, switched it to fgets and ran clang-format on the file on my branch here [1] - I'm never sure the best way to move this type of thing forward. Should I just create a new pull request?

[1] - https://github.com/wishdev/nng/tree/fgets

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

Successfully merging this pull request may close these issues.

4 participants