| 519 | } |
| 520 | |
| 521 | int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, char const* file) |
| 522 | { |
| 523 | char** pfile; |
| 524 | if (!cp) { |
| 525 | return 0; |
| 526 | } |
| 527 | switch (prPipe) { |
| 528 | case kwsysProcess_Pipe_STDIN: |
| 529 | pfile = &cp->PipeFileSTDIN; |
| 530 | break; |
| 531 | case kwsysProcess_Pipe_STDOUT: |
| 532 | pfile = &cp->PipeFileSTDOUT; |
| 533 | break; |
| 534 | case kwsysProcess_Pipe_STDERR: |
| 535 | pfile = &cp->PipeFileSTDERR; |
| 536 | break; |
| 537 | default: |
| 538 | return 0; |
| 539 | } |
| 540 | if (*pfile) { |
| 541 | free(*pfile); |
| 542 | *pfile = 0; |
| 543 | } |
| 544 | if (file) { |
| 545 | *pfile = strdup(file); |
| 546 | if (!*pfile) { |
| 547 | return 0; |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | /* If we are redirecting the pipe, do not share it or use a native |
| 552 | pipe. */ |
| 553 | if (*pfile) { |
| 554 | kwsysProcess_SetPipeNative(cp, prPipe, 0); |
| 555 | kwsysProcess_SetPipeShared(cp, prPipe, 0); |
| 556 | } |
| 557 | return 1; |
| 558 | } |
| 559 | |
| 560 | void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared) |
| 561 | { |
no test coverage detected
searching dependent graphs…