Desactive the question if the output is redirected to a file
ensure that
python ./madgraph5/bin/mg5 cmd.cmd &> out
runs to the end and don't poses any question to the user
Blueprint information
- Status:
- Complete
- Approver:
- Johan Alwall
- Priority:
- Low
- Drafter:
- None
- Direction:
- Approved
- Assignee:
- Olivier Mattelaer
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Olivier Mattelaer
- Completed by
- Johan Alwall
Related branches
Related bugs
Sprints
Whiteboard
The problem is the following
./madgraph5/bin/mg5 cmd.cmd &> cmd.out
can writte to stdout a question to the user and waiting answer to stdin. Since stdout is send to a file, the user didn't see the question, and then the program is still waiting for an answer to his question.
My proposal is to add a variable in madgraph.__init__ keeping track if need to ask questions or not.
When initialized it's should be possible to look if stdout is redirected (but not stdin). In such case we should bypass all question assuming a default value for all of them.
In addition we should authorize the user to put to activate this options with something like
./madgraph5/bin/mg5 cmd.cmd -f
What do you think Johan?
Johan: Excellent idea! Let's keep this open for v. 0.5.0.
Olivier:
I've try to look on how we can look if stdout is redirected and it's seems that python didn't make the redirection but bash does.
I.E. Python didn't know if they are a redirection or not. An then It's impossible to do what I suggest.
OLIVIER:
New suggestion implement a timer (maximum 3 min) for answering a question.
a working version is on UFO+DRAWER the difficult point is to choose when and how much wait for this ;-)