diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-09-19 13:01:04 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-09-19 13:01:04 (GMT) |
commit | 859bdb6b51d76058eb1a8bfa619a15978f50b251 (patch) | |
tree | 306ba7f92d84f10c0a7fc8e385cb32b85bb3cb73 /src/shell.c | |
parent | ff4fd84840beca40a88db2ca0ce90e6511fb852b (diff) |
Improved the pyoida module.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@116 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/shell.c')
-rw-r--r-- | src/shell.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/shell.c b/src/shell.c index 1f8d28d..2d3420f 100644 --- a/src/shell.c +++ b/src/shell.c @@ -105,7 +105,11 @@ GtkWidget *build_shell_panel(GObject *ref) vte_terminal_set_cursor_blinks(VTE_TERMINAL(term), TRUE); - //return result; +#if 0 + vte_terminal_fork_command (term, "/bin/sh", NULL, NULL, "/", 0, 0, 0); + return result; +#endif + openpty(&amaster, &aslave, name, NULL, NULL); @@ -264,6 +268,10 @@ static gpointer python_shell_thread(gpointer data) { FILE *stream; + int stdout2; + FILE *out2; + + printf("==== FE :: '%s'\n", ptsname(amaster)); printf("==== FE :: '%s'\n", ptsname(aslave)); @@ -279,38 +287,45 @@ static gpointer python_shell_thread(gpointer data) /* Mise à jour des entrées/sorties */ - /* + + stdout2 = dup(STDOUT_FILENO); + out2 = fdopen(stdout2, "w"); + + fprintf(out2, ">>> stdout2 :: %d\n", stdout2); + + +#if 1 close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); dup(aslave); dup(aslave); dup(aslave); - */ - +#endif Py_Initialize(); - amaster = STDIN_FILENO; - + //amaster = STDIN_FILENO; + /* write(amaster, "import pyoida\n", strlen("import pyoida\n")); write(amaster, "from pyoida import *\n", strlen("from pyoida import *\n")); + write(amaster, "logger.log_simple_message(2, 'uhih')\n", strlen("logger.log_simple_message(2, 'uhih')\n")); + write(amaster, "for i in pyoida.current_binary().lines():\n", strlen("for i in pyoida.current_binary().lines():\n")); + write(amaster, "\tprint i\n", strlen("\tprint i\n")); + */ - - write(amaster, "logger.log_simple_message(2, 'uhih')\n", strlen("logger.log_simple_message(2, 'uhih')\n")); - + write(amaster, "execfile('test.py')", strlen("execfile('test.py')")); - write(amaster, "for i in pyoida.current_binary().lines():\n", strlen("for i in pyoida.current_binary().lines():\n")); - write(amaster, "\tprint i\n", strlen("\tprint i\n")); + fprintf(out2, ">>> stdout2 :: %d (inside)\n", stdout2); |