I am using the one-click installer on windows (RC2). I can not get
output redirection to work with Kernel.system. Consider the following
code
F:\tmp\cont-test\test>cat test.rb
def test(command)
puts command
puts Kernel.system(command)
puts “---------------------------”
end
test(“mpto mp-test-01.mp”)
test(“mpto mp-test-01.mp > mp-test-01-test.tex”)
mpto.exe is a helper program that comes with metapost and is part of
most tex
distributions. It is included in my path environment. I have a file
mp-test-01.mp in the current directory. mpto scans the .mp file and
outputs on
stdout. I want to redirect that output to a file. But > does not work.
Running this program gives
F:\tmp\cont-test\test>ruby test.rb
mpto mp-test-01.mp
\gdef\mpxshipout{\shipout\hbox\bgroup
\setbox0=\hbox\bgroup}
\gdef\stopmpxshipout{\egroup \dimen0=\ht0 \advance\dimen0\dp0
\dimen1=\ht0 \dimen2=\dp0
\setbox0=\hbox\bgroup
\box0
\ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
\else \vrule width1sp height1sp depth0sp\relax
\fi\egroup
\ht0=0pt \dp0=0pt \box0 \egroup}
\mpxshipout% line 2 mp-test-01.mp
This is a test\stopmpxshipout
\end{document}
true
mpto mp-test-01.mp > mp-test-01-test.tex
false
system “mpto …” executes correctly (the true after \end{document})
while system “mpto … > …” fails. No mp-test-01-test.tex file is
created.
When I give the same commands from cmd.exe they work. I am confused why
something as simple as output redirection is not working. What is the
correct
way to do this?
Thanks,
Aditya