| 686 | } |
| 687 | |
| 688 | int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, char const* file) |
| 689 | { |
| 690 | char** pfile; |
| 691 | if (!cp) { |
| 692 | return 0; |
| 693 | } |
| 694 | switch (pipe) { |
| 695 | case kwsysProcess_Pipe_STDIN: |
| 696 | pfile = &cp->PipeFileSTDIN; |
| 697 | break; |
| 698 | case kwsysProcess_Pipe_STDOUT: |
| 699 | pfile = &cp->PipeFileSTDOUT; |
| 700 | break; |
| 701 | case kwsysProcess_Pipe_STDERR: |
| 702 | pfile = &cp->PipeFileSTDERR; |
| 703 | break; |
| 704 | default: |
| 705 | return 0; |
| 706 | } |
| 707 | if (*pfile) { |
| 708 | free(*pfile); |
| 709 | *pfile = 0; |
| 710 | } |
| 711 | if (file) { |
| 712 | *pfile = strdup(file); |
| 713 | if (!*pfile) { |
| 714 | return 0; |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | /* If we are redirecting the pipe, do not share it or use a native |
| 719 | pipe. */ |
| 720 | if (*pfile) { |
| 721 | kwsysProcess_SetPipeNative(cp, pipe, 0); |
| 722 | kwsysProcess_SetPipeShared(cp, pipe, 0); |
| 723 | } |
| 724 | |
| 725 | return 1; |
| 726 | } |
| 727 | |
| 728 | void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared) |
| 729 | { |
no test coverage detected
searching dependent graphs…