1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pipe question

Discussion in 'Plugins' started by vefatica, Aug 4, 2009.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,059
    Likes Received:
    30
    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.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,023
    Likes Received:
    84
    vefatica wrote:

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

    Rex Conn
    JP Software
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,059
    Likes Received:
    30
    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.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,023
    Likes Received:
    84
    vefatica wrote:

    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
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,059
    Likes Received:
    30
    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
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,059
    Likes Received:
    30
    I was afraid of something like that. No thanks. :-(
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,023
    Likes Received:
    84
    vefatica wrote:

    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
     

Share This Page