Thread overview
Putting dmd error through grep for dustmite
Nov 05, 2018
Dennis
Nov 05, 2018
Vladimir Panteleev
Nov 05, 2018
Dennis
November 05, 2018
I am debugging a case where operator overloading seems to break when I define the opBinary templates in a mixin template. On my own simple test-case it worked fine, so I'm trying to reduce my current code with dustmite.

The file tree is simply:

myproject/
  q16.d

And the command I run is:
```
$ dustmite myproject 'dmd -color=off -unittest q16.d 2>&1 | grep "Error: template \`util.q16.Q16_16.opBinary\` does not match any template declaration"' --no-redirect
```

It complains that the 'Initial test fails'. However, when I 'cd myproject' and run the command myself I get:
```
q16.d(167): Error: template `util.q16.Q16_16.opBinary` does not match any template declaration

$ echo $?
0
```

So for me it works. When I reduce the grep string to "util.q16.Q16_16.opBinary" it works on dustmite too, but it reduces too much since that condition is not precise enough. It seems that the backticks of `util.q16.Q16_16.opBinary` are the problem. I noticed that the back-ticks aren't there when the output is colorised, but adding -color=off didn't seem to make a difference. Removing them from the search or double-escaping them (like \\\`) also don't work.

Does anybody know what the problem is? I'm using Windows 10 and Git Bash.
November 05, 2018
On Monday, 5 November 2018 at 03:01:43 UTC, Dennis wrote:
> Does anybody know what the problem is? I'm using Windows 10 and Git Bash.

Sounds like the problem comes from the differences in shell syntax (quoting style) for the two shells here. When you run the command in Git Bash, the syntax used is Bash's. However, Dustmite will call shellExecute, which will pass the command to cmd.exe.

cmd.exe will interpret \` verbatim (i.e. as \`), so, try not quoting the ` characters (or just replace them with . if you want the command to work in both shells).

November 05, 2018
On Monday, 5 November 2018 at 03:13:26 UTC, Vladimir Panteleev wrote:
> cmd.exe will interpret \` verbatim (i.e. as \`), so, try not quoting the ` characters (or just replace them with . if you want the command to work in both shells).

Of course, the one thing I didn't try. Thanks!