1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

runProgram(): Distinguish between empty input and no input

For example, if we call brotli with an empty input, it shouldn't read
from the caller's stdin.
This commit is contained in:
Eelco Dolstra 2017-03-15 14:40:47 +01:00
parent 042975ea8e
commit 25dff2b7db
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
5 changed files with 30 additions and 15 deletions

View file

@ -170,10 +170,10 @@ int main(int argc, char * * argv)
Path unpacked = (Path) tmpDir + "/unpacked";
createDirs(unpacked);
if (hasSuffix(baseNameOf(uri), ".zip"))
runProgram("unzip", true, {"-qq", tmpFile, "-d", unpacked}, "");
runProgram("unzip", true, {"-qq", tmpFile, "-d", unpacked});
else
// FIXME: this requires GNU tar for decompression.
runProgram("tar", true, {"xf", tmpFile, "-C", unpacked}, "");
runProgram("tar", true, {"xf", tmpFile, "-C", unpacked});
/* If the archive unpacks to a single file/directory, then use
that as the top-level. */