Any idea or explanation?
tclsh%
I think this weird behaviour may be related to the fact of using a
windows program in a "unix" shell environment (cygwin mobaxterm), the
tclsh program cygwin is using is the one installed by magicsplat:
pd <euke...@gmail.com> wrote:
I think this weird behaviour may be related to the fact of using aIt is. Windows is very different internally from Unix (even if MS
windows program in a "unix" shell environment (cygwin mobaxterm), the tclsh program cygwin is using is the one installed by magicsplat:
claims and/or got is certified as 'posix' compatible) and you will find
lots of little tidbits like this where square pegs just don't fit
properly into round holes. At the Tcl script level the Tcl runtime
papers over the differences so the script see's little of them. But at
the interface just outside the runtime to the rest of the environment
you are at the mercy of whatever is handling that (in your case the
cygwin runtime).
Another one that can be very irritating when one uses "puts stderr" debugging sometimes is that pure GUI programs don't have a stdin/stderr/stdout IO channel available.
Hello,
I have a weird behaviour with tclsh in cygwin (mobaxterm) environment and I really doesn't know why so I'd really appreciate any clue.
Scenario:
I've installed magisplat in my windows 10 so I have tclsh available in my path.
When I open a cmd windows shell I can run tclsh and I get a tcl prompt (%) and command echo:
tclsh%
% puts "hello"
hello
But when I invoke tclsh from a mobaxterm terminal window I get no prompt and a solid squared cursor ([]):
$ tclsh
[]
puts "hello"
hello
[]
It also seems there's no command echo:
$ tclsh
set h hello
set h
puts "$h"
hello
[]
where it should be:
$ tclsh
% set h hello
hello
% set h
hello
% puts "$h"
hello
Also it seems tclsh is treating paths as windows style:
$ tclsh
puts "[set auto_path]"
C:/Apps/Tcl86/lib/tcl8.6 C:/Apps/Tcl86/lib
when I expect it would use unix like paths
My assumption:
I think this weird behaviour may be related to the fact of using a windows program in a "unix" shell environment (cygwin mobaxterm), the tclsh program cygwin is using is the one installed by magicsplat:
$ which tclsh
/drives/c/Apps/Tcl86/bin/tclsh
And so there's a clash between naming conventions, if I create a tcl file just to require package ticklecharts like:
lappend auto_path "/home/mobaxterm/myDownloads/tcl/ticklecharts-master"
puts "[set auto_path]"
package require ticklecharts
and run it from ticklechars dir:
$ pwd
/home/mobaxterm/myDownloads/tcl/ticklecharts-master
$ tclsh ej.tcl
C:/Apps/Tcl86/lib/tcl8.6 C:/Apps/Tcl86/lib /home/mobaxterm/myDownloads/tcl/ticklecharts-master
can't find package ticklecharts
while executing
"package require ticklecharts"
(file "ej.tcl" line 5)
changing the path to add to auto_path in the file to different values I get:
- with /drives/c/Users/p/Downloads/tcl/ticklecharts-master
$ tclsh ej.tcl
C:/Apps/Tcl86/lib/tcl8.6 C:/Apps/Tcl86/lib /drives/c/Users/p/Downloads/tcl/ticklecharts-master
can't find package ticklecharts
while executing
"package require ticklecharts"
(file "ej.tcl" line 5)
- with current dir (.):
$ tclsh ej.tcl
C:/Apps/Tcl86/lib/tcl8.6 C:/Apps/Tcl86/lib .
html:.\render.html
- with current dir as windows style path:
$ tclsh ej.tcl
C:/Apps/Tcl86/lib/tcl8.6 C:/Apps/Tcl86/lib {C:\Users\p\Downloads\tcl\ticklecharts-master}
html:.\render.html
So it reckonizes windows style paths only
Maybe this is the reason of weird behaviour too, a kind of clash with internal paths or files o even pipes.
Probably the solution is to install tcl from cygwin itself, but I really don't understand why it behaves so weird.
Of course If I execute tclsh from cygwin through cmd.exe everything goes ok:
$ cmd.exe /c tclsh.exe
% set h hello
hello
% set h
hello
Any idea or explanation?
Are you aware, that tcl may also be build using cygwin?
Perhaps, there is also a tclsh package within the cygwin distribution (I don't know).
The specific problem here is the "isatty()" posix function. This function does not work correctly in a Windows Console. This function is only used when Tclsh is built for "unix". The Windows build does not use this function. Instead, tclsh is built asa Console Application which guarantees a Windows console is present, and tclsh operates accordingly.
Since the "unix" build uses isatty(), and this function always returns "false" on Windows, tclsh does not enable interactive mode, which disables the prompt. If you type in: set tcl_interactive 1, then the prompt will appear.
El lunes, 27 de marzo de 2023 a las 8:18:36 UTC+2, Harald Oehlmann escribió:without needed. The problem was not so bad I coudn't live with it, it was just a weird problem and I really want to know the reason operating here, just for fun and knowing.
Are you aware, that tcl may also be build using cygwin?I'm pretty sure it can be build using cygwin because cygwin has packages to install tcl
Perhaps, there is also a tclsh package within the cygwin distribution (I don't know).yes there are a few packages:
$ apt-cyg find tcl
Trying to download file setup.ini
Updated setup.ini
Searching for installed packages matching tcl:
Searching for installable packages matching tcl:
mingw64-i686-tcl
mingw64-x86_64-tcl
octave-octclip
pidgin-tcl
ruby-tcltk
tcl
tcl-db
tcl-db4.8
tcl-devel
tcl-itcl
tcl-itcl-devel
tcl-itk
tcl-itk-devel
tcl-iwidgets
tcl-ming
tcl-solv
tcl-sqlite3
tcl-tcldot
tcl-tix
tcl-tk
tcl-tk-devel
tcl-togl
tcl-togl-devel
tcl-xapian
tcl-xapian-doc
tcl3270
tcltk
timidity++-tcltk
weechat-tcl
So, as I said previously, this problem should be solved just installed a cygwin package for tcl but I didn't install because I don't want to have two tcl systems installed (magicspalt and cygwin) maybe clashing each other and for sure duplicating space
regardsI have seen this problem also with other programs under Cygwin. I think it is buffering the output to screen in an awkward way.
pd wrote:Well, actually, you can get the standard channels to work in a "DOS-box" on WIndows. Try:
I think this weird behaviour may be related to the fact of using aIt is. Windows is very different internally from Unix (even if MS
windows program in a "unix" shell environment (cygwin mobaxterm), the tclsh program cygwin is using is the one installed by magicsplat:
claims and/or got is certified as 'posix' compatible) and you will find
lots of little tidbits like this where square pegs just don't fit
properly into round holes. At the Tcl script level the Tcl runtime
papers over the differences so the script see's little of them. But at
the interface just outside the runtime to the rest of the environment
you are at the mercy of whatever is handling that (in your case the
cygwin runtime).
Another one that can be very irritating when one uses "puts stderr" debugging sometimes is that pure GUI programs don't have a stdin/stderr/stdout IO channel available.
tclsh% package require Tk
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (0 / 16) |
Uptime: | 64:54:36 |
Calls: | 9,813 |
Calls today: | 1 |
Files: | 13,754 |
Messages: | 6,189,222 |