Piping data out to string or file (.piped)
bin_directory/command1:
#!/bin/bash
echo hello $1
#!/bin/bash
echo hello $1 1>&2
from commandlib import CommandPath
command_path = CommandPath("./bin_directory")
stdout to file handle:
with open("regular", "w") as handle:
command_path.command1("harry").piped.stdout_to_handle(handle).run()
File 'regular' will contain:
hello harry
stdout to filename:
command_path.command1("harry").piped.stdout_to_filename("regular").run()
File 'regular' will contain:
hello harry
stderr to file handle:
with open("error", "w") as handle:
command_path.command2("tom").piped.stderr_to_handle(handle).run()
File 'error' will contain:
hello tom
Executable specification
Documentation automatically generated from pipe.story storytests.