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

@ -671,7 +671,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
Path tmpDir = createTempDir();
AutoDelete autoDelete(tmpDir, true);
// FIXME: this requires GNU tar for decompression.
runProgram("tar", true, {"xf", storePath, "-C", tmpDir, "--strip-components", "1"}, "");
runProgram("tar", true, {"xf", storePath, "-C", tmpDir, "--strip-components", "1"});
unpackedStorePath = store->addToStore(name, tmpDir, true, htSHA256, defaultPathFilter, false);
}
replaceSymlink(unpackedStorePath, unpackedLink);