How to invert bool false/true in alias compose?
Timon Gehr
timon.gehr at gmx.ch
Sat Dec 7 04:08:09 UTC 2019
On 07.12.19 05:00, Marcone wrote:
> import std;
>
> alias cmd = compose!(to!bool, wait, spawnShell, to!string);
>
> void main(){
> writeln(cmd("where notepad.exe"));
> }
>
>
> Result:
>
> C:\Windows\System32\notepad.exe
> C:\Windows\notepad.exe
> false
>
>
> The result show "false" because good spawnshell command return 0 and 0
> to bool is false. But I want to invert false to true to get true or
> false if command success.
alias cmd = compose!(not!(to!bool), wait, spawnShell, to!string);
More information about the Digitalmars-d-learn
mailing list