Loading ...
Sorry, an error occurred while loading the content.

How does gvim detach itself from the parent shell?

Expand Messages
  • bgold12
    Hey, I ve written a few C++ programs that I use regularly, and it would be nice if I could get them to detach from the parent shell when I call them, but I
    Message 1 of 3 , Jan 1, 2009
    • 0 Attachment
      Hey, I've written a few C++ programs that I use regularly, and it
      would be nice if I could get them to detach from the parent shell when
      I call them, but I don't know how to do it. How does gvim do it?

      I'm on Windows (shell = command prompt).
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... IIUC, how gvim does it depends on the OS. Under X11 it uses fork(). Under Windows, a single binary cannot be used as both Console Vim and gvim. Only gvim
      Message 2 of 3 , Jan 1, 2009
      • 0 Attachment
        On 01/01/09 14:45, bgold12 wrote:
        > Hey, I've written a few C++ programs that I use regularly, and it
        > would be nice if I could get them to detach from the parent shell when
        > I call them, but I don't know how to do it. How does gvim do it?
        >
        > I'm on Windows (shell = command prompt).

        IIUC, how gvim does it depends on the OS. Under X11 it uses fork().
        Under Windows, a single binary cannot be used as both Console Vim and
        gvim. Only gvim (the GUI) detaches itself from the parent shell. You may
        want to browse the following source files:
        gui.h
        gui_w32_rc.h
        gui.c
        gui.w32.c
        gui.w48.c

        Best regards,
        Tony.
        --
        In a forest a fox bumps into a little rabbit, and says, "Hi,
        junior, what are you up to?"
        "I'm writing a dissertation on how rabbits eat foxes," said the
        rabbit.
        "Come now, friend rabbit, you know that's impossible!"
        "Well, follow me and I'll show you." They both go into the
        rabbit's dwelling and after a while the rabbit emerges with a satisfied
        expression on his face.
        Comes along a wolf. "Hello, what are we doing these days?"
        "I'm writing the second chapter of my thesis, on how rabbits
        devour wolves."
        "Are you crazy? Where is your academic honesty?"
        "Come with me and I'll show you." As before, the rabbit comes
        out with a satisfied look on his face and a diploma in his paw.
        Finally, the camera pans into the rabbit's cave and, as everybody
        should have guessed by now, we see a mean-looking, huge lion sitting
        next to some bloody and furry remnants of the wolf and the fox.

        The moral: It's not the contents of your thesis that are important --
        it's your PhD advisor that really counts.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • fritzophrenic
        ... Try using the start command in the cmd shell. For example, if your program s name is my_prgm.exe, you could launch it in a new (shell) window by typing:
        Message 3 of 3 , Jan 5, 2009
        • 0 Attachment
          On Jan 1, 7:45 am, bgold12 <bgol...@...> wrote:
          > Hey, I've written a few C++ programs that I use regularly, and it
          > would be nice if I could get them to detach from the parent shell when
          > I call them, but I don't know how to do it. How does gvim do it?
          >
          > I'm on Windows (shell = command prompt).

          Try using the "start" command in the cmd shell.

          For example, if your program's name is my_prgm.exe, you could launch
          it in a new (shell) window by typing:

          start my_prgm arg1 arg2

          This command can also be used from within Vim to start an external
          process and have Vim not wait for it to complete:

          :silent !start my_prgm
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.