Fix return value when reading from stdin

This commit is contained in:
Hackerpilot 2020-03-08 13:23:42 -07:00
parent b17304accd
commit e9034f4fec
1 changed files with 5 additions and 3 deletions

View File

@ -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
{
@ -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;
}
}