brushtechnology / fabricate

The better build tool. Finds dependencies automatically for any language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to redirect/capture run output to a file ?

GoogleCodeExporter opened this issue · comments

I have a linker command which outputs map data to stdout.
I tried using "> output.map" which failed because it is passed as an argument 
to the command itself and not to the shell.

In the original makefile, i have the following to capture the map file:
link options -o output objects > output.map

Is there a way to capture the stdout and let stderr to go to screen ?

Probably tee.exe may help to redirect the output to a file but the issue is to 
redirect output of a command to its own output file.

version: 1.26
OS: Windows7 64-bit

Original issue reported on code.google.com by satis...@gmail.com on 5 Jan 2014 at 8:40

bump! I tried `shell(..., stderr=subprocess.PIPE)` but it raises 

TypeError: type object got multiple values for keyword argument 'stderr'

May be there is a way to allow this simply? Of course it's possible to directly 
use subprocess.

Original comment by wer...@beroux.com on 11 Aug 2014 at 2:34

  • Added labels: ****
  • Removed labels: ****
And of course one could make it OS-specific, and use shell=True and shell pipe 
redirection of stderr to null.

Original comment by wer...@beroux.com on 11 Aug 2014 at 2:34

  • Added labels: ****
  • Removed labels: ****
Yes, the > re-direct notation is a shell thing, you need to run the command in 
the shell for it to work.

Original comment by ele...@gmail.com on 12 Aug 2014 at 1:47

  • Added labels: ****
  • Removed labels: ****