• Re: Can close of running program go wrong

    From Harald Oehlmann@21:1/5 to All on Mon Nov 22 16:46:49 2021
    Am 22.11.2021 um 15:28 schrieb Cecil Westerhof:
    I am opening a program with 'open |progName'. This of-course I put in
    a catch block.
    At the moment I have the close also in a catch block. But is this
    really necessary? Is it possible that after a successful open the
    close could give an error?


    I suppose, that if the program ends with a status inequal to 0, the
    close will throw an error ?

    In general, close can give errors. This is specially the case for
    asynchroneous processing, where the close returns the final state of the channel/file.

    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Mon Nov 22 16:55:48 2021
    * Cecil Westerhof <Cecil@decebal.nl>
    | I am opening a program with 'open |progName'. This of-course I put in
    | a catch block.
    | At the moment I have the close also in a catch block. But is this
    | really necessary? Is it possible that after a successful open the
    | close could give an error?

    As Harald said, any command in the pipeline exiting non-zero will
    trigger an error in close(n) unless you close the channel in nonblocking mode.

    man n open
    [...]
    If the command (or one of the commands) executed in the command
    pipeline returns an error (according to the definition in exec),
    !!! a Tcl error is generated when close is called on the channel
    !!! unless the pipeline is in non-blocking mode then no exit status
    is returned (a silent close with -blocking 0).


    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Cecil Westerhof@21:1/5 to All on Mon Nov 22 15:28:22 2021
    I am opening a program with 'open |progName'. This of-course I put in
    a catch block.
    At the moment I have the close also in a catch block. But is this
    really necessary? Is it possible that after a successful open the
    close could give an error?

    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)