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

TEE Problem

Discussion in 'Support' started by Just Another Joe, Jan 24, 2014.

  1. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    Using the following (as an example):

    copy srcdir dstdir | tee logfile

    the files are copied, and their names both displayed and logged.

    BUT, if copy has to prompt (overwrite file y/n?), then the prompt line is not displayed UNTIL the response (y or n) is given, after which both the prompt line and the response are displayed. It would be better if the prompt were displayed BEFORE the user typed the response.
     
  2. Christian Albaret

    Joined:
    Jul 1, 2008
    Messages:
    157
    Likes Received:
    1
    This comes from the fact that TEE+pipe flushes on newline. COPY's prompt does not end with a newline: the answer follows the end of the prompt on the same line, the newline comes after a (correct) answer. Having the prompt end with a newline would write one line for each prompt and one for each answer — though this could behave better when STDOUT is redirected.
     
  3. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    Yes; we wouldn't want COPY to send newline after every prompt normally, but if COPY could detect when its standard output is redirected, it could then issue newline after prompt, in order to make it usable with TEE. OR, even better, when redirected, it could flush the output without issuing a newline.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Need the DWIM parser...
     
  5. Rodolfo

    Joined:
    May 20, 2009
    Messages:
    216
    Likes Received:
    0
    On my pc I see a different behavior.

    Code:
    [C:\a]copy srcdir dstdir
    C:\a\srcdir =>! C:\a\dstdir (Replace) (Y/N/A/R)? Y
         1 file copied
    
    [C:\a]copy srcdir dstdir | tee logfile
    (Replace) (Y/N/A/R)? Y
    C:\a\srcdir =>! C:\a\dstdir     1 file copied
    
    [C:\a]copy srcdir dstdir | tee logfile
    (Replace) (Y/N/A/R)? N
    C:\a\srcdir =>! C:\a\dstdir     0 files copied
    
    So, I see immediately the prompt, but not the filenames, that appear after I have chosen Yes or No.
    Do You see a different behavior?

    What I consider as strange is that if instead of | I use |! the output is corrupted (usual issue with unicode?).

    Code:
    [C:\a]copy srcdir dstdir |! tee logfile
    (Replace) (Y/N/A/R)? Y
     ■C

    Regards

    Rodolfo Giovanninetti
     
  6. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    Sorry, my original post was not accurate. I immediately see all non-prompted filenames; I also see immediately the "Overwrite (Y/N)?" prompt, but I do not see the filename; if there are several prompts, I see all the prompts, but do not see any of the prompted filenames until either:
    1. there is a non-prompted file to be copied, in which case I see all the of previous prompted filenames before the unprompted filename, or until
    2. the copy operation is complete, after which I see all the previous (since the last unprompted filename) prompted filenames.
    This is because the prompts are sent to stderr, which is not being piped, whereas the filenames are sent to stdout and piped to TEE.

    As for "|!", I don't have any documentation, and so don't know what it is intended to do. Isn't "!" the overwrite-noclobber operator? I'm using TCC 13. Which version are you using?
     
  7. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    The |! is the special PC-DOS style piping operator - diirect the output to a temporary file, on completion make the file STDIN. Nothing to do with nolobber (other than the same character in a nonconflicting syntax).

    I suggest you use the feedback on this page to request that the feature be provided in the future.
     
  8. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    I should have added that, when the group of prompted filenames do appear, they all appear together as a single string, with no newline separating them.

    Also, if both stdout and stderr are piped (copy src dst |& tee log), then I do not see either the prompted filename nor the prompt, until I first answer the prompt (i.e. output just stops until the [unseen] prompt is answered).
     
  9. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    Thanks, Steve.
    Does "this page" refer to the page we are now reading, or was it intended to be a link to another page? I cannot find the term "feedback" anywhere on this page, other than in your post. Or am I misunderstanding you: rather than "feedback" meaning a link somewhere on this page, were you simply saying that I should use the information received in replies in this thread, to request the feature? And, where does one request a feature?
     
  10. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    Feedback button should be located on the middle left hand side of your browser window.
    Screenshot - 1_31_2014 , 15_35_08.png
     
  11. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    Thanks, John, but I don't have anything like that.
     
  12. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    If the "feedback" legend is not present on your browser, get in touch with Rex and 1/ get the URL for the feedback site, and 2/ communicate which browser you use and what its options are to find out why the legend is missing.
     

Share This Page