• tclexecomp won't print anything

    From Luc@luc@sep.invalid to comp.lang.tcl on Tue Dec 17 01:43:22 2024
    From Newsgroup: comp.lang.tcl

    I wrapped an entire Tk application with tclexecomp.

    It works. Everything works.

    Then I have some idea and decide to test something. The story gets
    long, but we can shorten it.

    Instead of a full-fledged application, only this script is packed:

    $ cat p1.tcl
    puts "hello"
    exit

    Yes, that's it.

    So I pack it and run it and nothing prints. Why?

    (In the slightly longer version of this story, I am trying to puts
    the output of [pwd], [glob *], [parray env] and source another .tcl
    file.)
    --
    Luc


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Rich@rich@example.invalid to comp.lang.tcl on Tue Dec 17 05:08:06 2024
    From Newsgroup: comp.lang.tcl

    Luc <luc@sep.invalid> wrote:
    I wrapped an entire Tk application with tclexecomp.

    It works. Everything works.

    Then I have some idea and decide to test something. The story gets
    long, but we can shorten it.

    Instead of a full-fledged application, only this script is packed:

    $ cat p1.tcl
    puts "hello"
    exit

    Yes, that's it.

    So I pack it and run it and nothing prints. Why?

    (In the slightly longer version of this story, I am trying to puts
    the output of [pwd], [glob *], [parray env] and source another .tcl
    file.)

    You left out a bit of critical info: Linux or Windows as OS?

    Under Linux, provided you are running that from within a terminal
    session (not 'launching' it by clicking an icon as in the usual
    windows way) you should see 'hello' output on the terminal.

    In windows, it depends upon what executable you use to launch it, not
    every windows executable gets a terminal (and if it does not get a
    terminal it has no stdout, so "puts" just disappear).

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Michael Niehren@michael@niehren.de to comp.lang.tcl on Tue Dec 17 08:51:42 2024
    From Newsgroup: comp.lang.tcl

    tclexecomp always starts tk (aka wish) if possible. If you start it on an headless linux server, it only starts an tclsh.
    So your "puts" will be on the TK-Console, which is on default not visible.
    Put an "console show" in the first line of your script and you will see your "puts" as an output in the console window.

    best regards
    Michael


    I wrapped an entire Tk application with tclexecomp.

    It works. Everything works.

    Then I have some idea and decide to test something. The story gets
    long, but we can shorten it.

    Instead of a full-fledged application, only this script is packed:

    $ cat p1.tcl
    puts "hello"
    exit

    Yes, that's it.

    So I pack it and run it and nothing prints. Why?

    (In the slightly longer version of this story, I am trying to puts
    the output of [pwd], [glob *], [parray env] and source another .tcl
    file.)


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Luc@luc@sep.invalid to comp.lang.tcl on Tue Dec 17 14:24:09 2024
    From Newsgroup: comp.lang.tcl

    On Tue, 17 Dec 2024 05:08:06 -0000 (UTC), Rich wrote:

    Luc <luc@sep.invalid> wrote:
    I wrapped an entire Tk application with tclexecomp.

    It works. Everything works.

    Then I have some idea and decide to test something. The story gets
    long, but we can shorten it.

    Instead of a full-fledged application, only this script is packed:

    $ cat p1.tcl
    puts "hello"
    exit

    Yes, that's it.

    So I pack it and run it and nothing prints. Why?

    (In the slightly longer version of this story, I am trying to puts
    the output of [pwd], [glob *], [parray env] and source another .tcl
    file.)

    You left out a bit of critical info: Linux or Windows as OS?

    Under Linux, provided you are running that from within a terminal
    session (not 'launching' it by clicking an icon as in the usual
    windows way) you should see 'hello' output on the terminal.

    In windows, it depends upon what executable you use to launch it, not
    every windows executable gets a terminal (and if it does not get a
    terminal it has no stdout, so "puts" just disappear).

    **************************

    It's Linux. I run it as ./p1 in a terminal session.
    --
    Luc


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Luc@luc@sep.invalid to comp.lang.tcl on Tue Dec 17 14:27:33 2024
    From Newsgroup: comp.lang.tcl

    On Tue, 17 Dec 2024 08:51:42 +0100, Michael Niehren wrote:

    tclexecomp always starts tk (aka wish) if possible. If you start it on an >headless linux server, it only starts an tclsh.
    So your "puts" will be on the TK-Console, which is on default not visible. >Put an "console show" in the first line of your script and you will see
    your "puts" as an output in the console window.

    best regards
    Michael
    **************************

    I still don't understand.

    If I run it as a script,

    $ wish ./p1.tcl

    there is output.

    But if I run the executable on a terminal,

    $ ./p1

    then there is no output.

    Like I said, I have packed a pretty much complete application with
    tclexecomp and it can output if I want it to.

    But an extremely simple script can't output.

    I still don't understand why.
    --
    Luc


    --- Synchronet 3.20a-Linux NewsLink 1.114