"! -t" instruction return true in Eclipse debug mode

Help
Serg
2013-06-27
2013-07-01
  • Serg
    Serg
    2013-06-27

    Hi to all.

    i have got a following portion of perl-code:

    if(! -t)
    {
    #some error-handling code + die
    }
    #some code

    this code had't written by me. Unfortunately ( or fortunately? ;) ) i'm C++ developer, but as i think, this if-statement checks console allocation by means of STDIN variable. correct me if I'm wrong.

    so, my problem is:
    when i start script in cmd-shell, "! -t" return false (i can see "#some code" output).
    when i start script in EPIC debugger in Eclipse, "! -t" return true. this cause execution of die-code.

    how can i avoide this situation?

    i have already red previous post about STDIN problem (https://sourceforge.net/p/e-p-i-c/discussion/258687/thread/66c850b1/), but there was several years ago... Nothing has changed?

    additional info: Win7, Eclipse Indigo Service Release 1, EPIC 0.6.51

     
  • Jan Ploski
    Jan Ploski
    2013-06-27

    The code works correctly. Because EPIC doesn't have any terminal emulation, -t evaluates to false. Same thing which would happen if you redirected STDIN with < on the command line.

     
  • Serg
    Serg
    2013-06-27

    thanks for reply!

    I thought that Eclipse output conlose emulates terminal...
    As for me this kind of emulation is required to debugging system. Otherwise how to test the code with user interaction? I mean "smoking" testing conducted by the developer.

    Can you advice me something with my debugging in this situation?

     
  • Serg
    Serg
    2013-07-01

    so.. what's about main question?))

    "how can i avoid this situation?"
    my ideas:
    1) comment code.. is the worst think.
    2) may be try to create a console?.. or somehow initialize STDIN..? but how to achieve this?
    3) ...

     
  • Jan Ploski
    Jan Ploski
    2013-07-01

    3) run the code which requires a terminal from a terminal (that is, from the shell, cmd.exe, possibly via an External Tools Configuration, or from some terminal emulator plugin, like the Remote Systems Explorer, but not from EPIC)
    4) set an environment variable on the Environment tab of the Run Configuration and modify the code to skip the offending check when this variable is set (this only makes sense if the code doesn't actually require a terminal to work, otherwise see 3 above; of course with 3 you won't be able to use EPIC debugger unless you go through the pains of setting up a Remote Debug configuration)