equal
deleted
inserted
replaced
155 abortmsgerrno("failed to restore signal handlers"); |
155 abortmsgerrno("failed to restore signal handlers"); |
156 } |
156 } |
157 |
157 |
158 /* This implementation is based on hgext/pager.py (post 369741ef7253) |
158 /* This implementation is based on hgext/pager.py (post 369741ef7253) |
159 * Return 0 if pager is not started, or pid of the pager */ |
159 * Return 0 if pager is not started, or pid of the pager */ |
160 static pid_t setuppager(hgclient_t *hgc, const char *const args[], |
160 static pid_t setuppager(const char *pagercmd) |
161 size_t argsize) |
161 { |
162 { |
|
163 const char *pagercmd = hgc_getpager(hgc, args, argsize); |
|
164 if (!pagercmd) |
162 if (!pagercmd) |
165 return 0; |
163 return 0; |
166 |
164 |
167 int pipefds[2]; |
165 int pipefds[2]; |
168 if (pipe(pipefds) < 0) |
166 if (pipe(pipefds) < 0) |
177 if (isatty(fileno(stderr))) { |
175 if (isatty(fileno(stderr))) { |
178 if (dup2(pipefds[1], fileno(stderr)) < 0) |
176 if (dup2(pipefds[1], fileno(stderr)) < 0) |
179 goto error; |
177 goto error; |
180 } |
178 } |
181 close(pipefds[1]); |
179 close(pipefds[1]); |
182 hgc_attachio(hgc); /* reattach to pager */ |
|
183 return pid; |
180 return pid; |
184 } else { |
181 } else { |
185 dup2(pipefds[0], fileno(stdin)); |
182 dup2(pipefds[0], fileno(stdin)); |
186 close(pipefds[0]); |
183 close(pipefds[0]); |
187 close(pipefds[1]); |
184 close(pipefds[1]); |