Changeset 6612 for pymolproxy/trunk


Ignore:
Timestamp:
Nov 11, 2016, 2:31:50 AM (8 years ago)
Author:
ldelgass
Message:

Add define to control if pymol stderr is logged, by default discard stderr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pymolproxy/trunk/pymolproxy.c

    r6610 r6612  
    109109#define WRITE_DEBUG 0
    110110#define EXEC_DEBUG  0
     111#define LOG_PYMOL_STDERR 0
    111112
    112113#define FORCE_UPDATE            (1<<0)
     
    21262127    if (child == 0) {  /* Child process */
    21272128        int f;
    2128         char tmpname[200];
     2129        char tmpname[BUFSIZ];
    21292130
    21302131        /*
     
    21402141        dup2(sout[1], 1); /* Server standard output */
    21412142
     2143#if LOG_PYMOL_STDERR
    21422144        /* Redirect child's stderr to a log file. */
    2143         sprintf(tmpname, "%s/PYMOL-%d-stderr.XXXXXX", LOGDIR, getpid());
    2144         f = mkstemp(tmpname);
     2145        sprintf(tmpname, "%s/pymol-%d.stderr", LOGDIR, getpid());
     2146        f = open(tmpname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
     2147#else
     2148        sprintf(tmpname, "/dev/null");
     2149        /* Discard stderr */
     2150        f = open(tmpname, O_WRONLY, 0600);
     2151#endif
    21452152        if (f < 0) {
    2146             ERROR("can't open file `%s' to capture pymol stderr: %s", tmpname,
     2153            ERROR("can't open \"%s\" to capture pymol stderr: %s", tmpname,
    21472154                  strerror(errno));
    21482155            exit(1);
     
    22732280            status = GetLine(&p->client, &numBytes, &line);
    22742281            if (status != BUFFER_OK) {
    2275                 ERROR("can't read client stdout (numBytes=%d): %s", numBytes,
    2276                       strerror(errno));
     2282                ERROR("can't read client stdout (numBytes=%d, status=$d): %s",
     2283                      numBytes, status, strerror(errno));
    22772284                goto done;
    22782285            }
     
    23752382            hdrLength = strlen(header);
    23762383#if WRITE_DEBUG
    2377             DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d", numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength);
     2384            DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d",
     2385                  numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength);
    23782386#endif
    23792387            imgPtr = NewImage(&list, numBytes + hdrLength);
     
    24202428    frecord = NULL;
    24212429    if (recording) {
    2422         char fileName[200];
     2430        char fileName[BUFSIZ];
    24232431
    24242432        sprintf(fileName, "/tmp/pymolproxy%d.py", getpid());
Note: See TracChangeset for help on using the changeset viewer.