Browse files

rdmd: Fix: --force doesn't work with --eval

  • Loading branch information...
1 parent 7aa1820 commit 72f40c8d135e6d5570f77cffb8f2d6ed42d8e8c3 Abscissa committed Mar 30, 2012
Showing with 11 additions and 5 deletions.
  1. +11 −5 rdmd.d
View
16 rdmd.d
@@ -649,12 +649,18 @@ int eval(string todo)
"eval." ~ digestToString(digest));
auto binName = progname ~ binExt;
- if (exists(binName) ||

The only change needed here is on this line:

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

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.

@Abscissa
Owner

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

@Abscissa
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- // Compile it
- (std.file.write(progname~".d", todo),
- run([ compiler, progname ~ ".d", "-of" ~ binName ]) == 0))
+ bool compileFailure = false;
+ if (!exists(binName) || force)
{
- // 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 ]);
}

0 comments on commit 72f40c8

Please sign in to comment.