Changeset 3371 in Sophya


Ignore:
Timestamp:
Oct 31, 2007, 11:50:01 PM (18 years ago)
Author:
ansari
Message:

nouveaux flags de redirect stdout/err (-doublered), Reza 31/10/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/ProgPI/piapp.cc

    r3146 r3371  
    5757              [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
    5858  -nored : Don't redirect stdout/stderr to piapp console
     59  -doublered : Redirect stdout/stderr to piapp console AND the terminal
    5960  -termread : Read commands on terminal (stdin)
    6061  -term : equivalent to -nored -termread -small
     
    8384         << "              [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]] \n"
    8485         << "  -nored : Don't redirect stdout/stderr to piapp console\n"
     86         << "  -doublered : Redirect stdout/stderr to piapp console AND the terminal \n"
    8587         << "  -termread : Read commands on terminal (stdin)\n"
    8688         << "  -term : equivalent to -nored -termread -small \n"
     
    102104{
    103105int ofa;
    104 bool fgfpe, fgsegv, fgred, fghidezsw, fgexec, fgsmall, fgtermrd;
     106bool fgfpe, fgsegv, fghidezsw, fgexec, fgsmall, fgtermrd;
     107RED_OUTERR_FLG fgred = CONSRED_OE;
    105108
    106109SkyTInitiator skyinit;
     
    112115
    113116ofa = 1;
    114 fgred = fgfpe = fgsegv = true;
     117fgred = CONSRED_OE;
     118fgfpe = fgsegv = true;
    115119fghidezsw = false;
    116120fgexec = false;
     
    124128int ka;
    125129for(ka=1; ka<narg; ka++) {
    126   if (strcmp(arg[ka],"-nored") == 0)   fgred=false;
     130  if (strcmp(arg[ka],"-nored") == 0)   fgred=NORED_OE;
     131  else if (strcmp(arg[ka],"-doublered") == 0)   fgred=DOUBLERED_OE;
    127132  else if (strcmp(arg[ka],"-nosig") == 0)   fgfpe=fgsegv=false;
    128133  else if (strcmp(arg[ka],"-termread") == 0)   fgtermrd=true;
    129134  else if (strcmp(arg[ka],"-term") == 0) 
    130     { fgred=false;  fgtermrd=true; fgsmall=true; }
     135    { fgred=NORED_OE;  fgtermrd=true; fgsmall=true; }
    131136  else if (strcmp(arg[ka],"-nosigfpe") == 0)   fgfpe=false;
    132137  else if (strcmp(arg[ka],"-nosigsegv") == 0)   fgsegv=false;
    133138  else if (strcmp(arg[ka],"-small") == 0)     fgsmall=true;
    134139  else if (strcmp(arg[ka],"-hidezswin") == 0)   fghidezsw=true;
    135   else if (strcmp(arg[ka],"-help2tex") == 0) { fgtexh=true; fgred=false; }
     140  else if (strcmp(arg[ka],"-help2tex") == 0) { fgtexh=true; fgred=NORED_OE; }
    136141  else if (strcmp(arg[ka],"-tmpdir") == 0) {
    137142    if (ka == narg-1) return Usage(true);
     
    198203
    199204// Gestion de redirection stdout/err et Signaux
    200 if (fgred) app->RedirectStdOutErr(true);
    201 else app->RedirectStdOutErr(false);
     205app->RedirectStdOutErr(fgred);
    202206app->CatchSignals(fgfpe, fgsegv);
    203207
     
    238242  rc = 0;   cont = false;
    239243  app->SetReady();
    240   if (fgred) app->RedirectStdOutErr(true);
     244  app->RedirectStdOutErr(fgred);
    241245  try {
    242246    app->Run();
     
    244248  catch(PThrowable exc) {  // Catching SOPHYA exceptions
    245249    app->Stop();
    246     app->RedirectStdOutErr(false); 
     250    app->RedirectStdOutErr(NORED_OE); 
    247251    //BUG ? fait planter OSF-cxx     fflush(stdout);
    248252    cout << endl;      cerr << endl;
     
    268272  catch(...) { // Catching all other exceptions
    269273    app->Stop();
    270     app->RedirectStdOutErr(false); 
     274    app->RedirectStdOutErr(NORED_OE); 
    271275    cout << endl;      cerr << endl;
    272276    cout << "\n piapp/main() exception catched ! " << endl;
     
    292296cout << "\n ------------------------------------------------ \n"
    293297     << " piapp: Cleaning up ... " << endl;
    294 
    295 app->RedirectStdOutErr(false); 
     298app->RedirectStdOutErr(NORED_OE); 
     299cout << "\n ------------------------------------------------ \n"
     300     << " piapp: Exiting - Cleaning up ... " << endl;
     301
    296302// -- ca fait planter sur linux -- Reza 04/2006 if (fgtermrd) cmdrdr.cancel();
    297303
Note: See TracChangeset for help on using the changeset viewer.