MiKTeX 2.5: Piped input and output

Thursday, 22 June 2006 03:31 by CSchenk

This is a new feature in Beta 11:

TeX's input/output primitives can now be used for unidirectional interprocess communication by prepending a pipe symbol to the file name.

If this feature is enabled, then \input "|command" starts the command interpreter (usually cmd.exe) to carry out the command. The output of the command becomes the input of TeX. For example:

\input "|dir/b"

typesets the file names of the current directory.

Likewise, it is possible to let TeX write something into the input stream of a command. For example:

\immediate\openout1 = "|unix2dos|sort > sorted"
\immediate\write 1 {b}
\immediate\write 1 {a}
\immediate\write 1 {c}
\immediate\closeout1
\input sorted

typesets a b c.

Piped input and output is disabled by default to avoid security problems. You enable the feature by specifying -enable-pipes on the TeX command-line.
 

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   MiKTeX Development
Actions:   E-mail | Permalink | Comments (5) | Comment RSSRSS comment feed

Related posts

Comments

June 22. 2006 13:01

The COMSPEC variable is used. That's hardcoded in the C runtime library (I'm
using _popen/_pclose).

CSchenk

June 22. 2006 13:23

Lionel Fourquaux

How is the command interpreter determined? Do you use the COMSPEC or SHELL environment variables, or some custom mechanism? Is there a way to override this choice from within TeX, or from the configuration tools? (Example scenario: I want to leave COMSPEC to its default value for compatibility, but I would like TeX to use directly the MS PowerShell).

Lionel Fourquaux

June 24. 2006 13:14

In the first example, I had found more logical to type

\input "dir/b |"

i.e. | at the end: the output of dir/b is input for TeX
keeping the convention
output of process # 1 | input of process #2

Maurice Lombardi

June 24. 2006 13:34

I agree. See www.tug.org/.../010720.html

CSchenk

August 13. 2006 02:23

Yuri

In the first example, how I can output the backslash symbol in directories and files names like C:\directory\file.ext?
I have an error because backslash is escape character.
Other problem is with the symbol "_" in files and directories names.
I solve this errors only by changing the catcodes of this symbols.
.

Yuri

Comments are closed