GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GTK2-Perl -> Bash subprocesses

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
pwnguin



Joined: 25 Aug 2008
Posts: 2

PostPosted: Mon Aug 25, 2008 11:13 am    Post subject: GTK2-Perl -> Bash subprocesses Reply with quote

Hi,

I'm new to both GTK+ and Perl and I'm writing my first little application. My application currently displays a few windows and dialogs but nothing advanced. At one point in my application however I need to handle subprocesses (I think anyway).

I have an expect script which is used to flash the firmware on a connected device. Basically my app polls the DHCP server, gets a list of IP addresses and will then run the expect script on each IP. I'd like to make this somewhat graphical, but I'm not sure what I need to do this.
For each IP address I want to create a small dialog window with a progress bar (or maybe just a label), and a textview. I want the textview to constantly append the text outputted from the expect script. So, say there are 5 connected devices, 5 dialogs would open with debug info from each Flash appended (the expect script prints out the debug info).

Now what I'm not so sure of is how should I go about doing this (which classes etc.)? I don't need any code, but pseudo code would be a big help :)

Currently, what I think need to do is:

Code: (Plaintext)
1
2
3
4
5
6
7
8

foreach IP address
  create a new dialog
  execute expect script
  ??? somehow update textview / progress bar ???
  wait to be closed by user
end foreach


However updating the textview and running the expect script in the background is where I am currently stumped. Any help on this would be really appreciated.

Thanks :)
Back to top
pwnguin



Joined: 25 Aug 2008
Posts: 2

PostPosted: Mon Aug 25, 2008 1:27 pm    Post subject: Reply with quote

Arch::Run seems to be what I'm looking for, but I'm still open to suggestions if there is a better way to do it :)
Back to top
Mk27
GTK+ Geek


Joined: 07 Aug 2008
Posts: 70
Location: NYC

PostPosted: Thu Aug 28, 2008 4:19 am    Post subject: Reply with quote

I'm guessing you should run the expect script with a shell script that will pipe stderr into a fifo. That way you can just use "exec" and not have to worry, if you set up an open read on the fifo. You may need some flush functions from IO::Handle for this...or not.

I'm learning gtk in C, but I've done a fair bit of perl/tk, and if there is any connection there may be a buffering issue on the GUI end too -- perl may wait for a lot more than one line before it updates the textview. The tk command is actually update.

good luck :o
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP