Navigation


Changeset 985:74a5e2b8ae19 in freeDiameter


Ignore:
Timestamp:
Mar 17, 2013, 9:45:00 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Make sure dbg_interactive is linked with a console for running. Use printf in that case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/dbg_interactive.c

    r974 r985  
    3636#include <Python.h>
    3737#include <freeDiameter/extension.h>
     38#include <unistd.h>
    3839
    3940/* wrapper generated by SWIG */
     
    6162        CHECK_FCT_DO(fd_core_waitstartcomplete(), goto end);
    6263       
    63         fd_log_debug("Starting interactive python interpreter [experimental].");
    64         if (!arg) {
    65                 fd_log_debug("Example syntax:");
    66                 fd_log_debug("   >>> print cvar.fd_g_config.cnf_diamid");
    67                 fd_log_debug("   '%s'", fd_g_config->cnf_diamid);
     64        if (arg) {
     65                fd_log_debug("Starting python interpreter with a script file [experimental].");
     66                Py_Main(2, dum);
     67        } else {
     68                if (!isatty(fileno(stdin)) || !isatty(fileno(stdout))) {
     69                        TRACE_ERROR("[dbg_interactive]: this extension requires freeDiameter to be run from a console terminal!");
     70                        goto end;
     71                }
     72                printf("Starting interactive python interpreter [experimental].\n");
     73                printf("Example syntax:\n");
     74                printf("   >>> print cvar.fd_g_config.cnf_diamid\n");
     75                printf("   '%s'\n", fd_g_config->cnf_diamid);
     76                Py_Main(1, dum);
    6877        }
    69         Py_Main(arg ? 2 : 1, dum);
    7078       
    7179end:   
Note: See TracChangeset for help on using the changeset viewer.