None of the overloads of kill are callable using argument types:
BoQsc
vaidas.boqsc at gmail.com
Tue May 19 09:29:28 UTC 2020
On Monday, 18 May 2020 at 20:40:47 UTC, Adam D. Ruppe wrote:
> On Monday, 18 May 2020 at 20:11:25 UTC, BoQsc wrote:
>> I'm trying to kill my own process
>
> Don't kill yourself, just `return` from main.
Returning does what I need, however I still need to get a working
example on killing/terminating for the future reference, just in
case. However as Ali Çehreli stated, there seems to be a bigger
problem, to why it is not possible right now.
import std.stdio : write, writeln, readln, writefln;
import std.process : spawnShell, wait, executeShell, kill,
thisProcessID;
import core.thread.osthread : getpid;
void main() {
spawnShell( "cls" ).wait;
executeShell("title HelloWorld");
executeShell("chcp 65001");
executeShell("mode con: cols=120 lines=30");
writeln("Hello, World!");
writeln("
▄ .▄▄▄▄ .▄▄▌ ▄▄▌ ▄▄▌ ▐ ▄▌ ▄▄▄ ▄▄▌ ·▄▄▄▄
██▪▐█▀▄.▀·██• ██• ▪ ██· █▌▐█▪ ▀▄ █·██• ██▪ ██
██▀▐█▐▀▀▪▄██▪ ██▪ ▄█▀▄ ██▪▐█▐▐▌ ▄█▀▄ ▐▀▀▄ ██▪ ▐█· ▐█▌
██▌▐▀▐█▄▄▌▐█▌▐▌▐█▌▐▌▐█▌.▐▌ ▐█▌██▐█▌▐█▌.▐▌▐█•█▌▐█▌▐▌██. ██
▀▀▀ · ▀▀▀ .▀▀▀ .▀▀▀ ▀█▄▀▪ ▀▀▀▀ ▀▪ ▀█▄▀▪.▀ ▀.▀▀▀ ▀▀▀▀▀•
A Tale of HelloWorld");
writeln("
┌──------------┐
▒░░░┼┼┼┼┼┐ ≡▒░ ¦
___▒▒▒▒▒▒┼┤┼▒▒▒▒▒▒▓");
writeln("
~¨(··)¸
<│ >
‗┌═¬‗´
");
writefln("Current process id: %s", getpid());
writeln("This process id: ", thisProcessID());
string line;
write("Your Input: ");
while ((line = readln()) !is null) {
if (line == "exit\x0a") {
writeln("Going down");
return;
}
write(line);
write("Your Input: ");
}
}
More information about the Digitalmars-d-learn
mailing list