Jump to page: 1 2
Thread overview
Problem with rdmd
Aug 30, 2013
eles
Aug 30, 2013
anonymous
Aug 30, 2013
eles
Aug 30, 2013
Jacob Carlborg
Aug 30, 2013
eles
Aug 31, 2013
Dicebot
Oct 01, 2013
eles
Sep 05, 2013
eles
Aug 31, 2013
Jacob Carlborg
Sep 01, 2013
eles
August 30, 2013
On Linux 64

$chmod +x htest
$cat ./htest
#!/usr/bin/env rdmd
import std.stdio;

void main() {
	writeln("hello world!");
}

then:

$./htest
Error: cannot read file ./htest.d
Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'

OTOH:

$cp htest htest.d
$./htest.d
hello world!

It seems that rdmd expects the script to bear the .d extension. This is not a very good choice, at least when writing git helper scripts.

For example, a "$git command" command would eventually try to execute the executable (script):

$git-command

The problem is that that line expects git-command, not git-command.d.

A workaround for this?

Thanks
August 30, 2013
On Friday, 30 August 2013 at 07:39:41 UTC, eles wrote:
> On Linux 64
>
> $chmod +x htest
> $cat ./htest
> #!/usr/bin/env rdmd
> import std.stdio;
>
> void main() {
> 	writeln("hello world!");
> }
>
> then:
>
> $./htest
> Error: cannot read file ./htest.d
> Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
>
> OTOH:
>
> $cp htest htest.d
> $./htest.d
> hello world!
>
> It seems that rdmd expects the script to bear the .d extension. This is not a very good choice

yup

[...]
>
> A workaround for this?

ln htest htest.d
August 30, 2013
On Friday, 30 August 2013 at 07:56:14 UTC, anonymous wrote:
> On Friday, 30 August 2013 at 07:39:41 UTC, eles wrote:
>> A workaround for this?
>
> ln htest htest.d

Thanks.
August 30, 2013
On 2013-08-30 09:39, eles wrote:
> On Linux 64
>
> $chmod +x htest
> $cat ./htest
> #!/usr/bin/env rdmd
> import std.stdio;
>
> void main() {
>      writeln("hello world!");
> }
>
> then:
>
> $./htest
> Error: cannot read file ./htest.d
> Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
>
> OTOH:
>
> $cp htest htest.d
> $./htest.d
> hello world!
>
> It seems that rdmd expects the script to bear the .d extension.

I'm pretty sure it's DMD that is the problem.

-- 
/Jacob Carlborg
August 30, 2013
On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote:
> On 2013-08-30 09:39, eles wrote:
>
> I'm pretty sure it's DMD that is the problem.

Yes. But that's, the least to say, limiting.

This:

https://github.com/D-Programming-Language/tools/blob/master/rdmd.d#L160

should be solved in other manner. Maybe creating a temporary copy. Or forcing dmd in some ways. Besides, for what reasons dmd would impose a .d extension?
August 31, 2013
On 2013-08-30 09:39, eles wrote:
> On Linux 64
>
> $chmod +x htest
> $cat ./htest
> #!/usr/bin/env rdmd
> import std.stdio;
>
> void main() {
>      writeln("hello world!");
> }
>
> then:
>
> $./htest
> Error: cannot read file ./htest.d
> Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
>
> OTOH:
>
> $cp htest htest.d
> $./htest.d
> hello world!
>
> It seems that rdmd expects the script to bear the .d extension. This is
> not a very good choice, at least when writing git helper scripts.
>
> For example, a "$git command" command would eventually try to execute
> the executable (script):
>
> $git-command
>
> The problem is that that line expects git-command, not git-command.d.
>
> A workaround for this?

Why don't just compile it manually once instead of using like a script?

-- 
/Jacob Carlborg
August 31, 2013
On Friday, 30 August 2013 at 13:32:25 UTC, eles wrote:
> On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote:
>> On 2013-08-30 09:39, eles wrote:
>>
>> I'm pretty sure it's DMD that is the problem.
>
> Yes. But that's, the least to say, limiting.
>
> This:
>
> https://github.com/D-Programming-Language/tools/blob/master/rdmd.d#L160
>
> should be solved in other manner. Maybe creating a temporary copy. Or forcing dmd in some ways. Besides, for what reasons dmd would impose a .d extension?

This is an ancient dmd misfeature - it treats `dmd test` as `dmd test.d`, adding .d silently. No idea if someone actually wants this behavior..
August 31, 2013
On 8/30/13 6:32 AM, eles wrote:
> On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote:
>> On 2013-08-30 09:39, eles wrote:
>>
>> I'm pretty sure it's DMD that is the problem.
>
> Yes. But that's, the least to say, limiting.
>
> This:
>
> https://github.com/D-Programming-Language/tools/blob/master/rdmd.d#L160
>
> should be solved in other manner. Maybe creating a temporary copy. Or
> forcing dmd in some ways. Besides, for what reasons dmd would impose a
> .d extension?

One possible solution would be for rdmd to create a link in its temporary directory to the original file. (The link would have a .d extension.)

Andrei

September 01, 2013
Bah, what would be the meaning of accepting the shebang syntax then? SCripts are made to provide a quick way to hack: you edit it for 5 mins, you run it. You change a parameter inside, you run it. Otherwise, there would be no need for scripts, everything could be compiled, even if you fill everything with system() statements.

On Saturday, 31 August 2013 at 11:08:57 UTC, Jacob Carlborg wrote:
> On 2013-08-30 09:39, eles wrote:
>> On Linux 64
>>
>> $chmod +x htest
>> $cat ./htest
>> #!/usr/bin/env rdmd
>> import std.stdio;
>>
>> void main() {
>>     writeln("hello world!");
>> }
>>
>> then:
>>
>> $./htest
>> Error: cannot read file ./htest.d
>> Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
>>
>> OTOH:
>>
>> $cp htest htest.d
>> $./htest.d
>> hello world!
>>
>> It seems that rdmd expects the script to bear the .d extension. This is
>> not a very good choice, at least when writing git helper scripts.
>>
>> For example, a "$git command" command would eventually try to execute
>> the executable (script):
>>
>> $git-command
>>
>> The problem is that that line expects git-command, not git-command.d.
>>
>> A workaround for this?
>
> Why don't just compile it manually once instead of using like a script?

September 05, 2013
On Saturday, 31 August 2013 at 17:42:21 UTC, Andrei Alexandrescu wrote:
> On 8/30/13 6:32 AM, eles wrote:
>> On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote:
>>> On 2013-08-30 09:39, eles wrote:
> One possible solution would be for rdmd to create a link in its temporary directory to the original file. (The link would have a .d extension.)

Isn't more reasonable to change dmd's behavior?
« First   ‹ Prev
1 2