Re: [Vala] Getting programs output



Hi.
it should only be a matter of setting up the UI and then read from
output_fd. for this to work nicely with gtk+ and so on you should do
the reading in a callback. to create this callback you create a
Glib.Source and the you add your file for polling with add_poll() .

alternatively, you could use vte which is a complete terminal emulator widget.

2009/7/29 Arkadi Viner <arkashkin gmail com>:
Hello.
I am really new to VALA and my Linux programing experience is very small.
I am writing some code to execute a program from my program, and i want to
know how can I upgrade my code so it will update
some textbox on a real-time with the executed program's std_output..

I use this function to execute the another program:

public static void execProgram()
  {
         string[] argv = new string[1];
            argv[0] = "/home/arkadi/tt";
            //argv[1] = null;

            Pid child_pid;
            int input_fd;
            int output_fd;
            int error_fd;
            try {
            Process.spawn_async_with_pipes(
                command_line,
                argv, //argv
                null,   // environment
                SpawnFlags.SEARCH_PATH,
                null,   // child_setup
                out child_pid,
                out input_fd,
                out output_fd,
                out error_fd);
           }
           catch (Error e) {
         stderr.printf ("Could not load UI: %s\n", e.message);
         }
  }

So I need a little bit help :-)

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]