Created
February 10, 2013 15:58
-
-
Save jgrahamc/4750014 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func redirect(to string, from *os.File) (err error) { | |
if out, err := os.Create(name); err == nil { | |
err = syscall.Dup2(int(out.Fd()), int(from.Fd())) | |
} else { | |
err = fmt.Errorf("Unable to create file %s", to) | |
} | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment