My own terminal > Running a background process

This is a discussion on My own terminal > Running a background process within the C Programming forums, part of the General Programming Boards category; Hello, I have been coding my own terminal over the last few weeks and I've stumbled upon a little problem. ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Smile My own terminal > Running a background process

    Hello,

    I have been coding my own terminal over the last few weeks and I've stumbled upon a little problem.

    I can run programs from the terminal fine but when I try to run something in the background, for example, "firefox &" it still opens in the foreground.

    However if I put the '&' at the beginning, it does open in the background.

    Does anyone know the correct code to run things in the background?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Sounds like you've already figured it out.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    It involves a different system call - what OS are you using? In *nix, you would fork(), then exec() in the child process. On windows, have a look at the spawn() family of functions. I'm a little confused about your question, though - you already have programs running in the background, it's just the placement of the '&'. So, what's your command parser doing? Or are you just passing all input to system()?

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    I think it was run as a background process only , but it might print some lines which makes you to think as a foreground process.

    If my understanding is right ?
    Please try this $ firefox >/dev/null &

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detect Close of a background process
    By Schwarzhelm in forum C Programming
    Replies: 1
    Last Post: 11-05-2003, 12:46 AM
  2. running program in the background
    By sunil21 in forum C Programming
    Replies: 2
    Last Post: 09-07-2003, 05:57 PM
  3. I'm stupid, my winapp still running in background
    By Shadow12345 in forum Windows Programming
    Replies: 3
    Last Post: 01-14-2003, 08:22 PM
  4. background process switches to stopped
    By bonkey in forum Linux Programming
    Replies: 3
    Last Post: 11-20-2002, 07:27 AM
  5. Running program on background?
    By Couhilin in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2001, 06:50 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21