ruby - Exit program and open file -


hello stuck in situation need run command after program exits.

reason :

myapp1.exe needs updated new version myapp2.exe. so, myapp1.exe should terminated before start myapp2.exe, else inno setup not let me install new version old version still running.

file.open("myapp2.exe", "wb") |saved_file|  open("http://example.com/myapp2.exe", "rb") |read_file|        saved_file.write(read_file.read)      end   end   `start "" "myapp2.exe"`   exit 

now start command before exit, want start new downloaded myapp2.exe, exit first , start installer.

please help

i think can achieved using kernel::exec instead of backticks or system method. unlike other shell-invoking commands, exec replaces running process (i.e. ruby interpreter) new process.

your whole script be

  file.open("myapp2.exe", "wb") |saved_file|      open("http://example.com/myapp2.exe", "rb") |read_file|        saved_file.write(read_file.read)      end   end   exec 'start "" "myapp2.exe"' 

you cannot continue statements following exec, program exit @ point.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -