Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Pipe question

May
13,215
180
If I do this in a plugin:

Code:
SetStdHandle(STD_OUTPUT_HANDLE, hPipe);
Command(Buffer, 0);
SetStdHandle(STD_OUTPUT_HANDLE, hSave);
and Buffer contains a compound command, like

Code:
echo foo & echo foo
only the output of the first ECHO makes it into the pipe. Is this my fault? Regardless, is there anything I can do to get all the output?

Thanks.
 
vefatica wrote:

> If I do this in a plugin:
>
>
> Code:
> ---------
> SetStdHandle(STD_OUTPUT_HANDLE, hPipe);
> Command(Buffer, 0);
> SetStdHandle(STD_OUTPUT_HANDLE, hSave);
> ---------
> and Buffer contains a compound command, like
>
>
> Code:
> ---------
> echo foo & echo foo
> ---------
> only the output of the first ECHO makes it into the pipe. Is this my fault? Regardless, is there anything I can do to get all the output?

Use a command group. Otherwise, Command() will undo the redirection
after the first command.

Rex Conn
JP Software
 
vefatica wrote:

SetStdHandle(..., hPipe);
Command(...);

Use a command group. Otherwise, Command() will undo the redirection
after the first command.

OK, but I also notice that if a single command produces more than one line of output (like DIR) only the first line is written to the pipe.
 
vefatica wrote:

> ---Quote (Originally by rconn)---
> vefatica wrote:
>
> SetStdHandle(..., hPipe);
> Command(...);
>
> Use a command group. Otherwise, Command() will undo the redirection
> after the first command.
> ---End Quote---
> OK, but I also notice that if a single command produces more than one line of output (like DIR) only the first line is written to the pipe.

Command() is where TCC processes all redirection. If you're going to do
your own redirection, don't call Command() as you're just going to cause
confusion and mayhem as TCC has no way of knowing what you've done.

If you want to do your own pipes, then you should use your own parsing &
output routines.

Rex Conn
JP Software
 
Use a command group. Otherwise, Command() will undo the redirection
after the first command.

And that doesn't seem to work. The pipe client sends `(echo foo & echo foo)`. The server sees it and reports: Remote command: (echo foo & echo foo). Then the server redirects the handle and calls Command(). But the client only sees (with some debug stuff):

Bytes read: 5
foo
102 111 111 13 10
 
Command() is where TCC processes all redirection. If you're going to do
your own redirection, don't call Command() as you're just going to cause
confusion and mayhem as TCC has no way of knowing what you've done.

If you want to do your own pipes, then you should use your own parsing &
output routines.

I was afraid of something like that. No thanks. :-(
 
vefatica wrote:

> ---Quote (Originally by rconn)---
> Use a command group. Otherwise, Command() will undo the redirection
> after the first command.
> ---End Quote---
> And that doesn't seem to work. The pipe client sends `(echo foo & echo foo)`. The server sees it and reports: Remote command: (echo foo & echo foo). Then the server redirects the handle and calls Command(). But the client only sees (with some debug stuff):
>
> Bytes read: 5
> foo
> 102 111 111 13 10

I have no idea what you're trying to do, but it almost certainly won't
work with Command(), which is going to be unhappy with your redirection
attempts. (And which is going to promptly undo them!)

Rex Conn
JP Software
 
Back
Top
[FOX] Ultimate Translator
Translate