0

The SublimeRestart plugin restarts ST3 on Windows like this:

subprocess.call('taskkill /im sublime_text.exe /f && cmd /C "'+ os.path.join(os.getcwd(), 'sublime_text.exe') + '"', shell=True)

[Full code] The problem is, when Sublime restarts, the active project is the one from the last time Sublime was properly exited.

Changing it to

self.window.run_command('exit')
subprocess.call(os.path.join(os.getcwd(), 'sublime_text.exe'))

[Full code] causes it to hang for 20-30 seconds before exiting, and then does not restart it at all.

Is there a way to do something like this?

self.window.run_command('save_current_project_state')
subprocess.call('taskkill /im sublime_text.exe /f && cmd /C "'+ os.path.join(os.getcwd(), 'sublime_text.exe') + '"', shell=True)

Or to just handle this in a different way?

Thanks.

aliteralmind
  • 19,847
  • 17
  • 77
  • 108
  • 1
    Why not use `Alt+F4` to quit, then click on the icon to restart (I put mine in the taskbar next to the Start button)? What's the use case for a plugin, especially if it isn't working correctly? – MattDMo Jan 04 '15 at 23:45
  • @MattDMo I need to restart it frequently when using files on a network drive, in order to get the sidebar to properly refresh. Often the folders in the sidebar don't have any items at all (they're just spinning and spinning) until it's restarted, which means you can't open anything via the "go to anything" dialog. Hitting Ctrl+Alt+Shift+F4 to trigger the plugin is faster. – aliteralmind Jan 05 '15 at 00:48
  • I've come up with a reasonable workaround: ctrl+shift+w to close Sublime, and then F10 to open it, which I've assigned to it's taskbar shortcut. – aliteralmind Jan 07 '15 at 16:27
  • That sounds like a good idea. I couldn't really think of any other way to do it, other than a never-ending Python script: `while True: ...`. – MattDMo Jan 07 '15 at 16:29
  • Related: http://stackoverflow.com/questions/28051492/how-to-force-folder-refresh-in-sublime-when-project-refresh-doesnt-work – aliteralmind Jan 20 '15 at 17:55

0 Answers0