D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7918 - Crash when using heredoc syntax in DMD v2.05[89] on Win7 [64bit]
Summary: Crash when using heredoc syntax in DMD v2.05[89] on Win7 [64bit]
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-15 10:36 UTC by Redger
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments
Crash when using heredoc syntax in DMD v2.05[89] on Win7 [64bit] (563 bytes, application/octet-stream)
2012-04-15 10:36 UTC, Redger
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Redger 2012-04-15 10:36:48 UTC
Created attachment 1089 [details]
Crash when using heredoc syntax in DMD v2.05[89] on Win7 [64bit]

A sample program is attached : I tried to call the powershell, passing a script
to get a value. When using a string it works, when using the heredoc syntax to
create the string it compiles but then it fails at runtime.



PS C:\misc> .\crash.exe
std.file.FileException@std\file.d(294):
44b7b89aba64d47f8cdf665a20c8b22fe0947a3c0664e7c8dbe730911161fef: The system
cannot find the file specified.
----------------
413670
4134FB
406CA5
402056
4025E8
402622
402243
4342F5
----------------


Here is the code:

string sh = "powershell -Sta -NoProfile -NonInteractive -Command ";

//when uncommented the line below works! :)
//string script = "$date = get-date; $date.ToString('o');";

//using the heredoc syntax it fails :(
string script = q"SCR
$date = get-date;
$date.ToString('o');
SCR";

//escape script for powershell
string cmd = sh~'"'~script~'"';

writeln( "result: " ~ shell(cmd) );
Comment 1 Dejan Lekic 2012-04-20 05:55:39 UTC
Can you do something like this on Windows 7:

C:\work> powershell -Sta -NoProfile -NonInteractive -Command "
$date = get-date;
$date.ToString('o');
" [ENTER]

Can you?
Comment 2 Dejan Lekic 2012-04-20 05:58:27 UTC
(In reply to comment #1)
> Can you do something like this on Windows 7:
> 
> C:\work> powershell -Sta -NoProfile -NonInteractive -Command "
> $date = get-date;
> $date.ToString('o');
> " [ENTER]
> 
> Can you?

Actually, it is like this:

C:\work> powershell -Sta -NoProfile -NonInteractive -Command "$date = get-date;
$date.ToString('o');
" [ENTER]