Why does this script BSOD-ize windows ?

Baz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 21 03:14:58 PDT 2015


---
import std.process;
import core.thread;
import std.random;

void main(string[] args)
{
     string on = "netsh interface set interface \"Connexion au 
réseau local\" Enable";
     string off = "netsh interface set interface \"Connexion au 
réseau local\" Disable";

     while(true)
     {
         executeShell(on);
         Thread.sleep(dur!("msecs")(uniform(2000, 5000)));
         executeShell(off);
         Thread.sleep(dur!("msecs")(2000));
     }
}
---

It's stable if i remove the random time after connecting, 
otherwise in the current shape it crashes Windows. Don't know 
why. Any idea ?

Note that you can test by replacing the name of my interface by 
yours ('Connexion au réseau local').


More information about the Digitalmars-d-learn mailing list