Thread: My own terminal > Running a background process

  1. #1
    Registered User
    Join Date
    Feb 2010

    Smile My own terminal > Running a background process


    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
    Katy, Texas
    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
    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
    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, 01: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, 09:22 PM
  4. background process switches to stopped
    By bonkey in forum Linux Programming
    Replies: 3
    Last Post: 11-20-2002, 08:27 AM
  5. Running program on background?
    By Couhilin in forum A Brief History of
    Replies: 1
    Last Post: 11-03-2001, 07:50 AM

Tags for this Thread