Closed Bug 585091 Opened 10 years ago Closed 3 years ago

Support simple input/output redirection in pymake native commands

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ted, Unassigned)

References

Details

(Whiteboard: [pymake])

Right now you can't use input/output redirection in combination with Pymake commands. The command parser errors out if any shell metacharacters are seen, which includes < and >:
http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/file/e50be3234e39/pymake/data.py#l1177

It wouldn't be hard to support output redirection for native commands. If we limited it to just supporting stdin/stdout/stderr then it'd just be a matter of swapping out sys.std{in,out,err} in PythonJob.run like we do with os.environ, and swapping them back in the finally block:
http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/file/e50be3234e39/pymake/process.py#l175

The only complicated part is probably parsing the redirections out of the command and then removing them before parsing the rest of the command.

This would be useful because we have things that use Preprocessor.py but redirect the output to a file. We also have commands like `printf "foo" > file` which would be a pretty trivial native command otherwise.
See also bug 585113 about line continuations.
Mass close of pymake-related bugs.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.