UCBerkeleySETI/rawspec

When initialization fails, exit status = 0

texadactyl opened this issue · 0 comments

While running rawspec as a step in a bash script, it would be helpful if a non-zero exit status was returned to the shell when initialisation fails. I suggest making the following one line change in rawspec.c:

          // Initialize for new dimensions and/or conjugation <------------------------- (line 533)
          ctx.Nb = 0;           // auto-calculate
          ctx.Nb_host = 0;      // auto-calculate
          ctx.h_blkbufs = NULL; // auto-allocate
          if(rawspec_initialize(&ctx)) {
            fprintf(stderr, "rawspec initialization failed\n");
            close(fdin);
            // Forget new dimensions
            ctx.Nc   = 0;
            ctx.Np   = 0;
            ctx.Ntpb = 0;
            ctx.Nbps = 0;
            return 1;  // <--------------------------------------------------- was "break"

Console log:

using requested GPU: 3
rawspec using librawspec 2.3.1
working stem: /datax/scratch/rawspec_test_baseline/blc13_guppi_57991_49836_DIAG_FRB121102_0010
opening file: /datax/scratch/rawspec_test_baseline/blc13_guppi_57991_49836_DIAG_FRB121102_0010.0000.raw
number of bits per sample must be 8 or 16 (not 524288), using 8 bps
Nts[0] cannot be 0
rawspec initialization failed
output product 0: 0 spectra
DEBUG rawspec exit status: 0