Skip to content

Commit

Permalink
rdmd: Fix: --force doesn't work with --eval
Browse files Browse the repository at this point in the history
  • Loading branch information
Abscissa committed Mar 30, 2012
1 parent 7aa1820 commit 72f40c8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rdmd.d
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -649,12 +649,18 @@ int eval(string todo)
"eval." ~ digestToString(digest)); "eval." ~ digestToString(digest));
auto binName = progname ~ binExt; auto binName = progname ~ binExt;


if (exists(binName) || bool compileFailure = false;

This comment has been minimized.

Copy link
@andralex

andralex Mar 30, 2012

The only change needed here is on this line:

if ((exists(binName) && !force) ||

This comment has been minimized.

Copy link
@andralex

andralex Mar 30, 2012

On second thought reverting the order is even better:

if ((!force && exists(binName)) ||

That way, no time is wasted checking for the binary if force is true.

This comment has been minimized.

Copy link
@Abscissa

Abscissa via email Mar 30, 2012

Owner

This comment has been minimized.

Copy link
@andralex

andralex Mar 30, 2012

Fine. Please swap the order of !exists(binName) || force in your version and we're good to go.

This comment has been minimized.

Copy link
@Abscissa

Abscissa via email Mar 30, 2012

Owner
// Compile it if (!exists(binName) || force)
(std.file.write(progname~".d", todo),
run([ compiler, progname ~ ".d", "-of" ~ binName ]) == 0))
{ {
// It's there, just run it // Compile it
std.file.write(progname~".d", todo);
if( run([ compiler, progname ~ ".d", "-of" ~ binName ]) != 0 )
compileFailure = true;
}

if (!compileFailure)
{
// Run it
exec([ binName ]); exec([ binName ]);
} }


Expand Down

0 comments on commit 72f40c8

Please sign in to comment.