6.13.10.2.23. Capture command output

This is unix dependent at present.
Start python section to interscript/frames/inputf.py[33 /40 ] Next Prev Last
   929: #line 1289 "input_frame.ipk"
   930:   def capture_output(self,command):
   931:     commands = self.global_frame.commands
   932:     status, output = commands.getstatusoutput(command)
   933:     data = string.split(output,'\n')
   934:     return (status,data)
   935: 
   936:   def print_output(self,command,description=None):
   937:     status, data = self.capture_output(command)
   938:     weaver = self.get_weaver()
   939:     if description: cmd = description
   940:     else: cmd = command
   941:     weaver.test_output_head(cmd, status)
   942:     for i in range(len(data)):
   943:       line = data[i]
   944:       l = string.rstrip(line)
   945:       weaver.echotangle(i+1,l)
   946:     weaver.test_output_foot(cmd, status)
   947:     return (status, data)
   948: 
   949:   def capture_python_output(self,script):
   950:     return self.capture_output('"'+sys.executable+'" '+script)
   951: 
   952:   def print_python_output(self,script, description=None):
   953:     return self.print_output(
   954:       '"'+sys.executable+'" '+script,
   955:       description)
   956: 
   957:   def print_python_test_output(self,script, descr):
   958:     testno = self.pass_frame.get_new_test_number()
   959:     testlabel = 'test_'+str(testno)
   960:     self.pass_frame.tests[testno]=[descr,testlabel,'python','Unknown']
   961:     self.set_anchor(testlabel)
   962:     return self.print_python_output(script,descr)
   963: 
End python section to interscript/frames/inputf.py[33]