On 5/30/22 04:18, Alexander Zhirov wrote:
> I want to run a command in the background
The closest is spawnShell:
import std.stdio;
import std.process;
import core.thread;
void main() {
auto pid = spawnShell(`(sleep 10000 & echo SLEEP >> log)`);
Thread.sleep(5.seconds);
kill(pid);
writeln("Terminated with ", wait(pid));
}
I am not good at shell scripting but I had to change your && to & to see
anything in log.
As std.process documentation explains, the value returned by wait() (and
more) are platform dependent.
Ali