bgrace
bgrace

Reputation: 1

How to remove command line buffering

I am launching a tool through a doit task that can optionally be driven interactively. In conjunction with this I'm running with '--verbosity 2' in order to enable this tool's command line to be sent to STDOUT. The issue is the command line is buffered when this tool's interface is active which prevents immediate feedback on what is being typed. Each line is not seen until return is entered. I added the following to dodo.py as a resolution:

from doit.action import CmdAction
def task_progress():
   return {
     'actions': [CmdAction("progress_bar", buffering=1)],
}

This fails with the messages: . progress /bin/sh: progress_bar: command not found TaskError - taskid:progress Command error: 'progress_bar' returned 127

Is there a better solution to remove the lag when entering commands to this tool or am I misreading the documentation?

Upvotes: 0

Views: 87

Answers (1)

bgrace
bgrace

Reputation: 1

A better solution to this problem is the use of Interactive:

from doit.tools import Interactive

def task_interact(): """run some_tool""" return { 'actions': [Interactive('some_tool -log logs/your_uid -some_arg')], 'verbosity' : 2, }

Upvotes: 0

Related Questions