Tcl script killing process

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tcl script killing process

  • Creator
    Topic
  • #50957
    Joseph Benigno
    Participant

    First let me apologize for this lengthy post. I wrote a lengthy Tcl script and when I run it in Production, I hang the process. I cannot Stop / Start the process because I wind up with a

Viewing 5 reply threads
  • Author
    Replies
    • #68185
      garry r fisher
      Participant

      Hi Joe,

      At a guess I would say that your call to the remote exe is causing the problem. I’ve had similar problems when calling external programs from within Tcl.

      How are you calling the program? I assume your code is set up to wait for it to return – If so this is could be the problem.

      I either have to rewrite my code to operate using a & on the exec or even look at alternative ways of doing the same process.

      Can you paste in the code aroung your call so that we can see what you are doing?

      Regards

      Garry

    • #68186
      Joseph Benigno
      Participant

      Here is the sub-proc that does the call to the external program uudeview.exe:

      proc decodePDF {} {

      # Use uudeview.exe to decode the string

      #     it is located in “E:quovadxqdx5.3integratortcluudeview”

      # Temporarily change the working directory to “E:quovadxqdx5.3integrator”

      #     so that the uuDecoded PDF is written there

      # After the decode reset the working directory back

      #

      puts stdout “nproc decodePDF running”

         upvar 1 myName myVar      ; # Needed in case we get an error

         set currPath [pwd]        ; # Save the current default path (directory)

         set wrkPath  [file join “E:/” “quovadx” “qdx5.3” “integrator”]

      # The exec command runs the DOS program uudeview.exe,

      #     the -i option is not interactive

      #     the -c option is clean up after (delete encoded file after it is decoded)

      # The catch command is used to capture errors if any and

      #     allow an orderly shutdown of the script.

      # First change the working directory to where we want the PDF

      #

         cd $wrkPath

         set status [catch {exec — {E:\quovadx\qdx5.3\integrator\tcl\uudeview\uudeview.exe} {-i} {-c} {E:\quovadx\qdx5.3\integrator\tcl\uudeview\cnvStr.uue}} res2]

      # Reset the working directory

         cd $currPath

      puts stdout “status:    $status”

      puts stdout “result2: $res2”

         if {$status != 1} {

             puts stdout “n$myVar:    Call to uudeview failed! $res2”

             return 1

         } else {

             return 0

         }

      } ; # end of decodePDF

      Yes I wait for this to complete, before executing the next statement.

    • #68187
      Charlie Bursell
      Participant

      It looks like you are running Cloverleaf 5.3 which means Tcl 8.4.

      If you are on Windows 2003 there are problems with the way Windows buffers it output and Tcl 8.3.  I spoke to Jeff Hobbs of ActiveState about this and his answer was that W20003 was not even on the drawing board when Tcl 8.3 came out.

      You have two choices:

      1.  Up date Cloverleaf to the latest version to update Tcl to 8.4

      2.  The following work-around

      Anytime you use exec, redirect the output.  If I do not need the output, I redirect it to null.  If I need it I redirect to a file and then read the file.

      # If output not needed

      exec something > nul

      # If needed

      exec something > mytemp

      set rslts [read_file -onewline mytemp]

      file delete mytemp

      It is a pain but you gotta do what you gotta do  ðŸ˜€

    • #68188
      Ron Archambault
      Participant

      Interesting. I

    • #68189
      Charlie Bursell
      Participant

      Jeff Hobbs seemed to think it had to do with the way Windows buffers its output.  I don’t think we have had much of a problem since we went to Tcl 8.4.

      Perhaps yours is also a viable workaround since the /C creates a subshell in which to run the command.  I haven’t tried it at those places where I have had problems

    • #68190
      Joseph Benigno
      Participant

      Thanks for all of the suggestions.

      We are looking into upgrading, but would like to get new hardware along with it, so it won’t happen soon.

      We’ll look at some of the other ideas and we are also looking at re-working the process to do some of the work outside of the engine.

      Thanks

Viewing 5 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10