[Update text for system.cmd stuff John Goerzen **20071024101703] { hunk ./en/ch20-systems.xml 452 + + Invoking External Commands + + The System.Cmd module provides a cross-platform way + to invoke external commands. This could let you call system utilities + or + start up programs to gather data from the user. The functions in + System.Cmd pause execution of your Haskell program + while the new program runs, then continue where it left off after the + called program terminates. + + + The most useful if the functions in System.Cmd is + rawSystem. It takes an executble name and a list of + command-line arguments to pass to it, and returns an exit code. You + can even test it from &ghci; like this: + + &cmd.hs:all; + + rawSystem does not pass the command or its arguments + through the shell. This is an important safety and integrity feature. + The shell may perform wildcard expansion, argument parsing, and other + tasks on the input. This can lead to problems or even security risks + when dealing with things as simple as filenames containing spaces or + strings containing punctuation. For this reason, we recommend using + rawSystem instead of alternatives such as + system at all times. + + hunk ./en/ch20-systems.xml 485 - Many programmers need to run programs, process their output, and then - feed that output into other programs. One way to accomplish that is - with piping. + We've just seen how to invoke external programs. Sometimes we need + more control that that. Perhaps we need to obtain the output from + those programs, provide input, or even chain together multiple external + programs. Piping can help with all of these needs. }