368 outputChannels["e"] = errorBuffer.write |
368 outputChannels["e"] = errorBuffer.write |
369 |
369 |
370 inputChannels = {} |
370 inputChannels = {} |
371 if prompt is not None: |
371 if prompt is not None: |
372 def func(size): |
372 def func(size): |
373 if outputBuffer is None: |
373 msg = "" if outputBuffer is None else outputBuffer.getvalue() |
374 msg = "" |
|
375 else: |
|
376 msg = outputBuffer.getvalue() |
|
377 reply, isPassword = prompt(size, msg) |
374 reply, isPassword = prompt(size, msg) |
378 return reply, isPassword |
375 return reply, isPassword |
379 inputChannels["L"] = func |
376 inputChannels["L"] = func |
380 else: |
377 else: |
381 def myprompt(size): |
378 def myprompt(size): |
382 if outputBuffer is None: |
379 msg = (self.tr("For message see output dialog.") |
383 msg = self.tr("For message see output dialog.") |
380 if outputBuffer is None else outputBuffer.getvalue()) |
384 else: |
|
385 msg = outputBuffer.getvalue() |
|
386 reply, isPassword = self.__prompt(size, msg) |
381 reply, isPassword = self.__prompt(size, msg) |
387 return reply, isPassword |
382 return reply, isPassword |
388 inputChannels["L"] = myprompt |
383 inputChannels["L"] = myprompt |
389 if inputData is not None: |
384 if inputData is not None: |
390 inputChannels["I"] = inputData |
385 inputChannels["I"] = inputData |
391 |
386 |
392 self.__cancel = False |
387 self.__cancel = False |
393 self.__runcommand(args, inputChannels, outputChannels) |
388 self.__runcommand(args, inputChannels, outputChannels) |
394 if outputBuffer: |
389 |
395 out = outputBuffer.getvalue() |
390 out = outputBuffer.getvalue() if outputBuffer else "" |
396 else: |
391 err = errorBuffer.getvalue() if errorBuffer else "" |
397 out = "" |
|
398 if errorBuffer: |
|
399 err = errorBuffer.getvalue() |
|
400 else: |
|
401 err = "" |
|
402 |
392 |
403 self.__commandRunning = False |
393 self.__commandRunning = False |
404 |
394 |
405 return out, err |
395 return out, err |
406 |
396 |