aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/factory/open_common/factory.cpp
diff options
context:
space:
mode:
authoriddqd <iddqd@yandex-team.com>2024-06-10 10:07:19 +0300
committeriddqd <iddqd@yandex-team.com>2024-06-10 11:40:16 +0300
commit0f8b43a2792f618dce8711696ce5e394e7f3933d (patch)
treeb3b1b6c020161e906fde4712471c07d9e18ff5ef /library/cpp/streams/factory/open_common/factory.cpp
parent520001ecb8d8d5362f41e7db2b4ad5aab5afd8e6 (diff)
downloadydb-0f8b43a2792f618dce8711696ce5e394e7f3933d.tar.gz
Do not use minilzo and quicklz in open source. Export it to github.
d4d08d59dfff0c48a950a3faa36be4ac7e060912
Diffstat (limited to 'library/cpp/streams/factory/open_common/factory.cpp')
-rw-r--r--library/cpp/streams/factory/open_common/factory.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/library/cpp/streams/factory/open_common/factory.cpp b/library/cpp/streams/factory/open_common/factory.cpp
new file mode 100644
index 0000000000..c99ac44121
--- /dev/null
+++ b/library/cpp/streams/factory/open_common/factory.cpp
@@ -0,0 +1,19 @@
+#include "factory.h"
+
+#include <util/stream/file.h>
+#include <util/system/file.h>
+#include <util/generic/ptr.h>
+
+#ifdef _win_ // isatty
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+THolder<IInputStream> OpenStdin(size_t bufSize) {
+ if (isatty(0)) {
+ return MakeHolder<TUnbufferedFileInput>(Duplicate(0));
+ }
+ return MakeHolder<TFileInput>(Duplicate(0), bufSize);
+}
+