|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
vte_terminal_fork_command behaviorHi! I'm starting a little project and i need to include the vte widget in my application. I haven't experience with this widget and i wrote a little program only for testing and training and i'm seeing an strange behavior depending on the command i run. If I do vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); Vim is executed and i can interact with it. But if I run a program like "ls", which ends after directory listing, no output is shown, no matter what I do. How I can show output of programs that ends? Is this behavior normal? Thank you all in advance ignacio _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behavior2009-01-25 klockan 07:16 skrev Ignacio Butler: > If I do > vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); > > Vim is executed and i can interact with it. But if I run a program > like "ls", which ends after directory listing, no output is shown, no > matter what I do. > > How I can show output of programs that ends? Is this behavior normal? Perhaps the gnome-terminal code that provides the "do not close window when command exits" behaviour can serve as inspiration for you. — Wouter _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behaviorOn Sun, Jan 25, 2009 at 8:58 AM, Wouter Bolsterlee <wbolster@...> wrote: > 2009-01-25 klockan 07:16 skrev Ignacio Butler: >> If I do >> vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); >> >> Vim is executed and i can interact with it. But if I run a program >> like "ls", which ends after directory listing, no output is shown, no >> matter what I do. >> >> How I can show output of programs that ends? Is this behavior normal? > > Perhaps the gnome-terminal code that provides the "do not close window when > command exits" behaviour can serve as inspiration for you. > > — Wouter > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: This message was signed/encrypted using GnuPG. > > iD8DBQFJfEXfP7QTTiUKY+sRAh+4AKC+q/M3/e7pwx3USKnV1bWIbKunRQCgj8p6 > R8ru3Oxvq9vhXkG2GCP4yj8= > =MtkG > -----END PGP SIGNATURE----- > > You right Wouter, I've set gnome-terminal to run "ls ~/" instead shell and no close window after command exit and I had the same result: no output shown I'll try to implement this functionallity using pipes (or something like that) instead the vte. Thanks for the advice! ignacio _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behavior2009-01-25 klockan 16:43 skrev Ignacio Butler: > On Sun, Jan 25, 2009 at 8:58 AM, Wouter Bolsterlee <wbolster@...> wrote: > > 2009-01-25 klockan 07:16 skrev Ignacio Butler: > >> If I do > >> vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); > >> Vim is executed and i can interact with it. But if I run a program > >> like "ls", which ends after directory listing, no output is shown, no > >> matter what I do. > >> How I can show output of programs that ends? Is this behavior normal? > > Perhaps the gnome-terminal code that provides the "do not close window when > > command exits" behaviour can serve as inspiration for you. > I've set gnome-terminal to run "ls ~/" instead shell and no close > window after command exit and I had the same result: no output shown > I'll try to implement this functionallity using pipes (or something > like that) instead the vte. sh -c "'YOUR COMMAND LINE GOES HERE'; read;" In this case the spawned shell will wait for the user to hit Enter (or Ctrl-C or Ctrl-D) to exit. > Thanks for the advice! You're welcome. — Wouter _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behaviorOn Sun, Jan 25, 2009 at 8:16 AM, Wouter Bolsterlee <wbolster@...> wrote: > 2009-01-25 klockan 16:43 skrev Ignacio Butler: >> On Sun, Jan 25, 2009 at 8:58 AM, Wouter Bolsterlee <wbolster@...> wrote: >> > 2009-01-25 klockan 07:16 skrev Ignacio Butler: >> >> If I do >> >> vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); >> >> Vim is executed and i can interact with it. But if I run a program >> >> like "ls", which ends after directory listing, no output is shown, no >> >> matter what I do. >> >> How I can show output of programs that ends? Is this behavior normal? >> > Perhaps the gnome-terminal code that provides the "do not close window when >> > command exits" behaviour can serve as inspiration for you. >> I've set gnome-terminal to run "ls ~/" instead shell and no close >> window after command exit and I had the same result: no output shown >> I'll try to implement this functionallity using pipes (or something >> like that) instead the vte. > > Another approach would be to execute a command like this in the VTE widget: > > sh -c "'YOUR COMMAND LINE GOES HERE'; read;" > > In this case the spawned shell will wait for the user to hit Enter (or > Ctrl-C or Ctrl-D) to exit. > >> Thanks for the advice! > > You're welcome. > > — Wouter > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: This message was signed/encrypted using GnuPG. > > iD8DBQFJfJBwP7QTTiUKY+sRAu3dAJ9yTjz8YTRsWfWDuJZ+H3qbjOuXGACgoosT > zpgl+x7eaw7QAsWbYl5Yoo0= > =vlqj > -----END PGP SIGNATURE----- > > it worked. Here is the code: #include<gtk/gtk.h> #include<vte/vte.h> #include<stdio.h> void fork_done(VteTerminal *vte, gpointer udata) { printf("Process died!!\n"); } gboolean window_deleted( GtkWidget *w, GdkEvent *ev, gpointer data) { GtkWidget *vte = (GtkWidget*)data; char *text = "\n"; printf("Finish command\n"); vte_terminal_feed_child(VTE_TERMINAL(vte), text, strlen(text)); gtk_widget_hide_all(w); return TRUE; } int main(int argc, char* argv[]) { char *params[] = {"/bin/sh", "-c", "ls -l ~/;read",NULL}; char *env[] = {"PATH=/usr/bin:/bin:./usr/local/bin:/bin", NULL}; int child; gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); GtkWidget *table = gtk_table_new (1, 1, TRUE); GtkWidget *vte1 = vte_terminal_new (); gtk_signal_connect(GTK_OBJECT(vte1), "child-exited", G_CALLBACK(fork_done), NULL); gtk_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(window_deleted), vte1); gtk_table_attach_defaults (table, GTK_WIDGET(vte1), 0, 1, 0, 1); gtk_container_add (window, table); gtk_widget_show_all (window); child = vte_terminal_fork_command (VTE_TERMINAL(vte1), "sh", params, env, "~/", FALSE, FALSE, FALSE); printf("Child: %d\n", child); gtk_main (); return 0; } Thanks _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behavior2009-01-25 klockan 18:29 skrev Ignacio Butler: > > Another approach would be to execute a command like this in the VTE widget: > > sh -c "'YOUR COMMAND LINE GOES HERE'; read;" > > In this case the spawned shell will wait for the user to hit Enter (or > > Ctrl-C or Ctrl-D) to exit. > it worked. > Thanks Hi Ignacio, I'm glad you got things to work. > Here is the code: > [snip] > char *params[] = {"/bin/sh", "-c", "ls -l ~/;read",NULL}; Make sure that you properly escape any strings you include here, in case you do not hardcode it... > char *env[] = {"PATH=/usr/bin:/bin:./usr/local/bin:/bin", NULL}; I'm not quite sure this is a good thing to do. Not inheriting the standard environment may cause serious issues, like not being able to find programs in custom paths, not being able to use the X display, or not being able to use the DBus session bus, among many other things. — Wouter _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behaviorIt's true, that can cause my some troubles. I'll avoid overload enviroment. Thank you On Sun, Jan 25, 2009 at 9:34 AM, Wouter Bolsterlee <wbolster@...> wrote: > 2009-01-25 klockan 18:29 skrev Ignacio Butler: >> > Another approach would be to execute a command like this in the VTE widget: >> > sh -c "'YOUR COMMAND LINE GOES HERE'; read;" >> > In this case the spawned shell will wait for the user to hit Enter (or >> > Ctrl-C or Ctrl-D) to exit. >> it worked. >> Thanks > > Hi Ignacio, > > I'm glad you got things to work. > >> Here is the code: >> [snip] >> char *params[] = {"/bin/sh", "-c", "ls -l ~/;read",NULL}; > > Make sure that you properly escape any strings you include here, in case you > do not hardcode it... > >> char *env[] = {"PATH=/usr/bin:/bin:./usr/local/bin:/bin", NULL}; > > I'm not quite sure this is a good thing to do. Not inheriting the standard > environment may cause serious issues, like not being able to find programs > in custom paths, not being able to use the X display, or not being able to > use the DBus session bus, among many other things. > > — Wouter > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: This message was signed/encrypted using GnuPG. > > iD8DBQFJfKKpP7QTTiUKY+sRApCdAJ9T8KH1tSo0vS/g8qdIzphp+b3OTwCfVvQ1 > 04E8Fooqe5zP1AFfVUwgWHg= > =YAxb > -----END PGP SIGNATURE----- > > -- -o) / \\ _\_V cuando no tenes paredes, no necesitas ventanas who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep; _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behaviorIgnacio Butler wrote: > Hi! > > I'm starting a little project and i need to include the vte widget in > my application. I haven't experience with this widget and i wrote a > little program only for testing and training and i'm seeing an strange > behavior depending on the command i run. > > If I do > vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); > > Vim is executed and i can interact with it. But if I run a program > like "ls", which ends after directory listing, no output is shown, no > matter what I do. > > How I can show output of programs that ends? Is this behavior normal? Sounds like a bug. May have already been fixed. Please file a report at http://bugzilla.gnome.org/ behdad > Thank you all in advance > ignacio > _______________________________________________ > gnome-devel-list mailing list > gnome-devel-list@... > http://mail.gnome.org/mailman/listinfo/gnome-devel-list > _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
|
|
Re: vte_terminal_fork_command behaviorI'm not sure, i've tested only running in some gnome version from Archlinux repositories. I'll try to perform more tests before submit any kind of bug report. Maybe somebody could try this little program: #include<gtk/gtk.h> #include<vte/vte.h> #include<stdio.h> void fork_done(VteTerminal *vte, gpointer udata) { printf("Process died!!\n"); } gboolean window_deleted( GtkWidget *w, GdkEvent *ev, gpointer data) { GtkWidget *vte = (GtkWidget*)data; char *text = "\n"; printf("Finish command\n"); vte_terminal_feed_child(VTE_TERMINAL(vte), text, strlen(text)); gtk_widget_hide_all(w); return TRUE; } int main(int argc, char* argv[]) { char *params[] = {"/bin/sh", "-c", "ls -l ~/",NULL}; int child; gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); GtkWidget *table = gtk_table_new (1, 1, TRUE); GtkWidget *vte1 = vte_terminal_new (); gtk_signal_connect(GTK_OBJECT(vte1), "child-exited", G_CALLBACK(fork_done), NULL); gtk_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(window_deleted), vte1); gtk_table_attach_defaults (table, GTK_WIDGET(vte1), 0, 1, 0, 1); gtk_container_add (window, table); gtk_widget_show_all (window); child = vte_terminal_fork_command (VTE_TERMINAL(vte1), "sh", params, NULL, "~/", FALSE, FALSE, FALSE); printf("Child: %d\n", child); gtk_main (); return 0; } i've compiled this way: gcc vte.c `pkg-config --cflags --libs gtk+-2.0` `pkg-config --cflags --libs vte` (or something like this). Anyway, I'll run my own tests but I can survive with this "feature" hehehe Cheers On Tue, Jan 27, 2009 at 4:57 AM, Behdad Esfahbod <behdad@...> wrote: > Ignacio Butler wrote: >> Hi! >> >> I'm starting a little project and i need to include the vte widget in >> my application. I haven't experience with this widget and i wrote a >> little program only for testing and training and i'm seeing an strange >> behavior depending on the command i run. >> >> If I do >> vte_terminal_fork_command(w, "vim", NULL, NULL, ".", FALSE, FALSE, FALSE); >> >> Vim is executed and i can interact with it. But if I run a program >> like "ls", which ends after directory listing, no output is shown, no >> matter what I do. >> >> How I can show output of programs that ends? Is this behavior normal? > > Sounds like a bug. May have already been fixed. Please file a report at > http://bugzilla.gnome.org/ > > behdad > >> Thank you all in advance >> ignacio >> _______________________________________________ >> gnome-devel-list mailing list >> gnome-devel-list@... >> http://mail.gnome.org/mailman/listinfo/gnome-devel-list >> > -- who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep; _______________________________________________ gnome-devel-list mailing list gnome-devel-list@... http://mail.gnome.org/mailman/listinfo/gnome-devel-list |
| Free embeddable forum powered by Nabble | Forum Help |