| 259 | |
| 260 | |
| 261 | def start_cppfilt(): |
| 262 | (read_pipe, write_pipe) = os.pipe() |
| 263 | |
| 264 | # Fork. Run c++filt in the parent process, |
| 265 | # and then continue normal processing in the child. |
| 266 | pid = os.fork() |
| 267 | if pid == 0: |
| 268 | # child |
| 269 | os.dup2(write_pipe, sys.stdout.fileno()) |
| 270 | os.close(read_pipe) |
| 271 | os.close(write_pipe) |
| 272 | return |
| 273 | else: |
| 274 | # parent |
| 275 | os.dup2(read_pipe, sys.stdin.fileno()) |
| 276 | os.close(read_pipe) |
| 277 | os.close(write_pipe) |
| 278 | |
| 279 | cmd = ['c++filt'] |
| 280 | os.execvp(cmd[0], cmd) |
| 281 | |
| 282 | |
| 283 | def main(argv): |