File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 44
55using namespace nix ;
66
7+ static FdSink getNarSink ()
8+ {
9+ auto fd = getStandardOutput ();
10+ if (isatty (fd))
11+ throw UsageError (" refusing to write NAR to a terminal" );
12+ return FdSink (std::move (fd));
13+ }
14+
715struct CmdDumpPath : StorePathCommand
816{
917 std::string description () override
@@ -20,7 +28,7 @@ struct CmdDumpPath : StorePathCommand
2028
2129 void run (ref<Store> store, const StorePath & storePath) override
2230 {
23- FdSink sink ( getStandardOutput () );
31+ auto sink = getNarSink ( );
2432 store->narFromPath (storePath, sink);
2533 sink.flush ();
2634 }
@@ -51,7 +59,7 @@ struct CmdDumpPath2 : Command
5159
5260 void run () override
5361 {
54- FdSink sink ( getStandardOutput () );
62+ auto sink = getNarSink ( );
5563 dumpPath (path, sink);
5664 sink.flush ();
5765 }
You can’t perform that action at this time.
0 commit comments