"Nick Sabalausky" <[email protected]> wrote in message 
news:[email protected]...
> "Ellery Newcomer" <[email protected]> wrote in message 
> news:[email protected]...
>> What? No infinite loop? Your [lack of] stupidity disappoints me.
>
> Oops! Good catch! I'm so embarrased by my oversight. Here you go:
>
> $ cat rdmdFOREVER.d
> import std.process;
> void main()
> {
>    system("rdmd rdmdhello.d");
>    system("rdmd rdmdFOREVER.d");
> }
>
> $ rdmd rdmdFOREVER.d
> Hello world
> Hello world
> Hello world
...

And just for the hell of it:

$ cat rdmdFOREVERish.d
import std.file;
import std.process;
void main()
{
    system("rdmd rdmdhello.d");

    if(!exists("KILL-FOREVERish-NOW"))
        system("rdmd rdmdFOREVERish.d");
}

But you don't expect to kill it MANUALLY, without even using rdmd once, do 
you? So here:

$ cat killFOREVERish.d
import std.conv;
import std.file;
import std.process;
import std.stdio;
void main(string[] args)
{
    int theFinalCountdown = 5; // DOOT! DO DO DOOOO DOOT!!
    if(args.length > 1)
    {
        try theFinalCountdown = to!int(args[1]);
        catch(Throwable e){}
    }

    if(theFinalCountdown <= 0)
    {
        writeln("DIE, FOREVER! DEAD DEAD DEAD!!");
        mkdir("KILL-FOREVERish-NOW");
    }
    else
    {
        writeln(theFinalCountdown);
        --theFinalCountdown;
        system("rdmd killFOREVERish.d "~to!string(theFinalCountdown));
    }
}


Reply via email to