Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-restart Snippet Implemented #42

Open
tomouchuu opened this issue Sep 18, 2016 · 1 comment
Open

Auto-restart Snippet Implemented #42

tomouchuu opened this issue Sep 18, 2016 · 1 comment
Milestone

Comments

@tomouchuu
Copy link
Member

tomouchuu commented Sep 18, 2016

$loop = 1;
while ($loop)
{
    $process = Start-Process "myBot.exe" -Wait -NoNewWindow -PassThru
    switch ($process.ExitCode)
    {
        0 {"Restarting..."; Start-Sleep -s 3}
        1 {"Exiting."; $loop = 0;}
        default {"Unhandled Exit Code, Exiting."; $loop = 0}
    }
}
# In your bot, you can use Environment.Exit(0) to restart, or Environment.Exit(1) to kill.

Action the above into the script.

This may also help close #23

@tomouchuu tomouchuu added this to the V3 milestone Sep 18, 2016
@tomouchuu
Copy link
Member Author

Auto restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant