RE: Win32 redirection problem (Rob: for 2.3?)

new topic     » topic index » view thread      » older message » newer message

Hi fellow Euphorians!

Reading this thread I'm glad (well, not so much) to see I'm not the only one to
stumble on this problem.

Actually I'm rather disappointed because my aim was to re-write some NT tools
(mostly from SDK) to customize them. For
instance I wanted to write a diff.exe (file compare) like the one from the SDK
but with refinements like ignoring comment
lines or taking case into account only for some lines and not for others. All I
would have had to do was to replace the
existing binary with my own production on all the NT boxes where scripts (.BAT
or .CMD) are running that call those tools,
and not having to bother about the scripts themselves. I thought Euphoria was
perfect for the job.

With the present behaviour of Euphoria this is just a myth. The following
program is simply not usable on an NT box.

object s
s = gets(0)
while not atom(s) do
puts(1, s)
s = gets(0)
end while

Why? If you invoke a windows version of it (exw / bindw) it opens a new console
and tries to read from it and write to it
so redirections are ignored. If you use it as a dos32 app (ex / bind)
redirections work fine ... as long as you use short
filenames which is, for my purpose, not practical.  And finally since a Euphoria
program is unaware of redirections in the
command line (they are stripped from the arguments in cmd_line()) you cannot
emulate them.

Similar problems arise if you call system() or system_exec() and try to capture
the output of the invoked commands. I think
that at least one of the problems is that system() and system_exec() invoke
command.com even on NT where cmd.exe would be
more appropriate to handle long filenames.

BTW I have asked Ian D. Mead, author of UltraEdit, how the capturing of command
output was done in his editor. He told me
Uedit uses anonymous pipes to redirect outputs. Unfortunately my knowledge in
windows functions wrapping in Euphoria is about
the same as my skills in piloting a space shuttle. In both cases I only expect a
lot of crashes. Therefore my dream of
forging a super toolbox for NT in Euphoria are vanishing. Sad, sad.

Henri Goffin

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu