Thread overview
Support of -run and source code from stdin
May 27, 2020
Andre Pany
May 28, 2020
Iain Buclaw
May 28, 2020
Andre Pany
May 27, 2020
Hi,
Dmd and ldc supports running source code from stdin:

```
echo 'void main(){}' | dmd -run -
```

It seems GDC does not support argument -run and I do not know wheter it supports reading source code from stdin?

Could this 2 featured be added to gdc?
This would solve the probe file issue mentioned here https://forum.dlang.org/post/uwxndbpxspwaofolksbr@forum.dlang.org

Kind regards
Andre
May 28, 2020
On Wednesday, 27 May 2020 at 21:40:38 UTC, Andre Pany wrote:
> Hi,
> Dmd and ldc supports running source code from stdin:
>
> ```
> echo 'void main(){}' | dmd -run -
> ```
>
> It seems GDC does not support argument -run and I do not know

I see no obvious use for having something like -run in the driver. Toolchain apps are more than capable of doing this themselves.

> wheter it supports reading source code from stdin?
>

gdc -x d -

The -x tells gcc what language to parse, as the driver is capable of handling all languages gcc knows about, eg -xc++.

> Could this 2 featured be added to gdc?
> This would solve the probe file issue mentioned here https://forum.dlang.org/post/uwxndbpxspwaofolksbr@forum.dlang.org
>

Looks like the description of the problem matches what this PR is fixing.

https://github.com/dlang/dub/pull/1941

Iain
May 28, 2020
On Thursday, 28 May 2020 at 04:58:26 UTC, Iain Buclaw wrote:
> On Wednesday, 27 May 2020 at 21:40:38 UTC, Andre Pany wrote:
>> Hi,
>> Dmd and ldc supports running source code from stdin:
>>
>> ```
>> echo 'void main(){}' | dmd -run -
>> ```
>>
>> It seems GDC does not support argument -run and I do not know
>
> I see no obvious use for having something like -run in the driver. Toolchain apps are more than capable of doing this themselves.
>
>> wheter it supports reading source code from stdin?
>>
>
> gdc -x d -
>
> The -x tells gcc what language to parse, as the driver is capable of handling all languages gcc knows about, eg -xc++.
>
>> Could this 2 featured be added to gdc?
>> This would solve the probe file issue mentioned here https://forum.dlang.org/post/uwxndbpxspwaofolksbr@forum.dlang.org
>>
>
> Looks like the description of the problem matches what this PR is fixing.
>
> https://github.com/dlang/dub/pull/1941
>
> Iain

Thanks for the info.
The issue is not about the compiled artifacts but about the probe modules (source code).
In some cases, they are not deleted (There is a module destructor in dub which should take care of).

Kind regards
André