**Goal:**

  1. User activates/deactivates a plugin
  2. Program re-compiles with/without the plugin
  3. The program starts up again



My program is a [website manager](https://nimwc.org) which is browser based. 
The user can enable and disable plugins from the plugin-page. The plugins are 
included at compiletime with macros, therefore I need to close the program, 
re-compile it with user specified parameters and then start it again.

I have been experimenting with execCmd() and startProcess() in various 
combination with supporting _.sh_ and _.nim_ files. But when my program has 
been recompiled under a new name, e.g. _-o:newName_ , I am closing ( _quit()_ ) 
the main-program-process, but this closes the child-processes running the 
support files, which should start the main-program-process again = the new 
compiled program does not start again.

My current solution is using a _script.sh_ with a loop and checking for 
_newName_ on each loop, but I do not want to force the end user to use this 
script for running the program. 
    
    
    until ./main-program; do
        echo "main-program exited $?.  Respawning.." >&2
        sleep 1
        cp main-program main-program.bak
        mv newName main-program
    done
    

Reply via email to