- Jmsg(jcr, M_INFO, 0, _("%s: %s\n"), name, line);
- }
- status = close_bpipe(bpipe);
- if (status != 0) {
- berrno be;
- Jmsg(jcr, M_ERROR, 0, _("Runscript: %s returned non-zero status=%d. ERR=%s\n"), name,
- be.code(status), be.bstrerror(status));
- return false;
+ while (fgets(line, sizeof(line), bpipe->rfd)) {
+ int len = strlen(line);
+ if (len > 0 && line[len-1] == '\n') {
+ line[len-1] = 0;
+ }
+ Jmsg(jcr, M_INFO, 0, _("%s: %s\n"), name, line);
+ }
+ status = close_bpipe(bpipe);
+ if (status != 0) {
+ berrno be;
+ Jmsg(jcr, M_ERROR, 0, _("Runscript: %s returned non-zero status=%d. ERR=%s\n"), name,
+ be.code(status), be.bstrerror(status));
+ goto bail_out;
+ }
+ Dmsg0(100, "runscript OK\n");
+ break;
+ case CONSOLE_CMD:
+ if (console_command) { /* can we run console command? */
+ if (!console_command(jcr, ecmd)) { /* yes, do so */
+ goto bail_out;
+ }
+ }
+ break;