def child_setup tmp
stdin = File.expand_path(File.join(tmp, 'stdin'))
stdout = File.expand_path(File.join(tmp, 'stdout'))
stderr = File.expand_path(File.join(tmp, 'stderr'))
program = File.expand_path(File.join(tmp, 'program'))
config = File.expand_path(File.join(tmp, 'config'))
if @stdin
open(stdin, 'w'){|f| relay @stdin => f}
else
FileUtils.touch stdin
end
FileUtils.touch stdout
FileUtils.touch stderr
c = {}
c['argv'] = @argv
c['env'] = @env
c['cwd'] = @cwd
c['stdin'] = stdin
c['stdout'] = stdout
c['stderr'] = stderr
c['program'] = program
open(config, 'w'){|f| YAML.dump c, f}
open(program, 'w'){|f| f.write child_program(config)}
c
end