Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 232d7868

Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt

  • ID 232d78687663884df38c106f9089f637509722fd
  • Vorgänger d0b60417
  • Nachfolger d13c7050

Rückgabewert von system-Aufrufen prüfen und ggf. Fehler ausgeben.

Unterschiede anzeigen:

SL/Template/HTML.pm
70 70
    $psfile .= ".ps";
71 71
  }
72 72

  
73
  system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} > $psfile");
73
  if (system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} > $psfile") == -1) {
74
    die "system call to $::lx_office_conf{applications}->{html2ps} failed: $!";
75
  }
74 76
  if ($?) {
75 77
    $self->{"error"} = $form->cleanup($::lx_office_conf{applications}->{html2ps});
76 78
    return 0;
......
102 104
    $pdffile .= ".pdf";
103 105
  }
104 106

  
105
  system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} | ps2pdf - $pdffile");
107
  if (system($::lx_office_conf{applications}->{html2ps} . " -f html2ps-config < $form->{tmpfile} | ps2pdf - $pdffile") == -1) {
108
    die "system call to $::lx_office_conf{applications}->{html2ps} failed: $!";
109
  }
106 110
  if ($?) {
107 111
    $self->{"error"} = $form->cleanup($::lx_office_conf{applications}->{html2ps});
108 112
    return 0;
SL/Template/LaTeX.pm
482 482
  $ENV{openin_any} = "p";
483 483

  
484 484
  for (my $run = 1; $run <= 2; $run++) {
485
    system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
486
           "> $form->{tmpfile}.err");
485
    if (system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
486
               "> $form->{tmpfile}.err") == -1) {
487
      die "system call to $latex failed: $!";
488
    }
487 489
    if ($?) {
488 490
      $ENV{HOME} = $old_home;
489 491
      $ENV{openin_any} = $old_openin_any;
......
494 496

  
495 497
  $form->{tmpfile} =~ s/tex$/dvi/;
496 498

  
497
  system("dvips $form->{tmpfile} -o -q > /dev/null");
499
  if (system("dvips $form->{tmpfile} -o -q > /dev/null") == -1) {
500
    die "system call to dvips failed: $!";
501
  }
498 502
  $ENV{HOME} = $old_home;
499 503
  $ENV{openin_any} = $old_openin_any;
500 504

  
501 505
  if ($?) {
502
    $self->{"error"} = "dvips : $!";
506
    $self->{"error"} = "dvips : $?";
503 507
    $self->cleanup('dvips');
504 508
    return 0;
505 509
  }
......
532 536
  $ENV{openin_any} = "p";
533 537

  
534 538
  for (my $run = 1; $run <= 2; $run++) {
535
    system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
536
           "> $form->{tmpfile}.err");
539
    if (system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
540
               "> $form->{tmpfile}.err") == -1) {
541
      die "system call to $latex failed: $!";
542
    }
543

  
537 544
    if ($?) {
538 545
      $ENV{HOME}     = $old_home;
539 546
      $ENV{openin_any} = $old_openin_any;
SL/Template/OpenDocument.pm
510 510

  
511 511
  $main::lxdebug->message(LXDebug->DEBUG2(), "  xauthority $xauthority\n");
512 512

  
513
  system("xauth add \"${display}\" . \"${mcookie}\"");
513
  if (system("xauth add \"${display}\" . \"${mcookie}\"") == -1) {
514
    die "system call to xauth failed: $!";
515
  }
514 516
  if ($? != 0) {
515 517
    $self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started (xauth: $!)";
516 518
    $main::lxdebug->leave_sub();
......
673 675
  }
674 676

  
675 677
  if (!$::lx_office_conf{print_templates}->{openofficeorg_daemon}) {
676
    system($::lx_office_conf{applications}->{openofficeorg_writer},
677
           "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless",
678
           "file:${filename}.odt",
679
           "macro://" . (split('/', $filename))[-1] . "/Standard.Conversion.ConvertSelfToPDF()");
678
    if (system($::lx_office_conf{applications}->{openofficeorg_writer},
679
               "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless",
680
               "file:${filename}.odt",
681
               "macro://" . (split('/', $filename))[-1] . "/Standard.Conversion.ConvertSelfToPDF()") == -1) {
682
      die "system call to $::lx_office_conf{applications}->{openofficeorg_writer} failed: $!";
683
    }
680 684
  } else {
681 685
    if (!$self->spawn_openoffice()) {
682 686
      $main::lxdebug->leave_sub();

Auch abrufbar als: Unified diff