Skip to content

Commit

Permalink
Fix return value when reading from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Mar 8, 2020
1 parent b17304a commit e9034f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dfmt/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ else
else
break;
}
return format("stdin", buffer, output.lockingTextWriter(), &config);
immutable bool formatSuccess = format("stdin", buffer,
output.lockingTextWriter(), &config);
return formatSuccess ? 0 : 1;
}
else
{
Expand Down Expand Up @@ -254,8 +256,8 @@ else
f.rawRead(buffer);
if (inplace)
output = File(path, "wb");
bool formatResult = format(path, buffer, output.lockingTextWriter(), &config);
if (!formatResult)
immutable bool formatSuccess = format(path, buffer, output.lockingTextWriter(), &config);
if (!formatSuccess)
retVal = 1;
}
}
Expand Down

0 comments on commit e9034f4

Please sign in to comment.