Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Simultaneous system calls...

by djerius (Beadle)
on Feb 06, 2014 at 20:36 UTC ( #1073762=note: print w/replies, xml ) Need Help??

in reply to Simultaneous system calls...

I've got a quick first question. Why are you using gnome-terminal to run fio? Could you not simply run it directly? Is fio an interactive program? If it isn't, then running it via gnome-terminal doesn't buy you anything (but pain).

On to your original question.

What happens when you run your gnome-terminal command directly from a shell prompt? Does it wait for the fio command to finish before returning, or does it return immediately?

When I run gnome-terminal from the command line, it returns immediately, the terminal is created and displayed.

However, if I run gnome-terminal --disable-factory it hangs around until the terminal exits.

So, for example,

gnome-terminal -e "sleep 10"
returns immediately, while
gnome-terminal --disable-factory -e "sleep 10"
waits for the sleep to complete before returning.

I'm not sure at all of the ramifications of --disable-factory. The documentation (which is terse and meaningless to me) does not mention this behavior.

You should try running your command directly (e.g. from the command line) before embedding it in your code to make sure it behaves as you expect.

Replies are listed 'Best First'.
Re^2: Simultaneous system calls...
by samh785 (Initiate) on Feb 06, 2014 at 22:28 UTC
    Hi djerius, thanks for your response. I actually ended up figuring this out before reading your response, and the solution was to use disable-factory like you suggested. What ended up happening(at least what I think the problem was) was that gnome-terminal was the child process and fio was the grand child. My script was waiting for gnome-terminal to open, which happened immediately. I needed gnome-terminal since fio has an output that I need to monitor. I wanted to be able to watch the output while also still being able to access my script. I ended up using disable-factory which caused my commands to be completed sequentially, and I put everything into a subroutine so that I could still access my perl script while fio was running. Thanks for your help and suggestions.
      Glad you got it figured out.

      If all else failed, the old-school alternative would be to run xterm or rxvt instead of gnome-terminal. Not as fancy looking, but no question about them hanging around.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073762]
[marto]: anytime
[karlgoethebier]: good day
[Corion]: Hi all ;)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-07-26 10:35 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (390 votes). Check out past polls.