aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/factory/open_common/factory.cpp
diff options
context:
space:
mode:
authoriddqd <iddqd@yandex-team.com>2024-06-05 13:17:15 +0300
committeriddqd <iddqd@yandex-team.com>2024-06-05 13:27:30 +0300
commitb942cd0f5ca4da903e5e203a90084fecc88076d0 (patch)
tree10e412736e495d78da1cc11837927787e7a07f3d /library/cpp/streams/factory/open_common/factory.cpp
parent64fd7c655b5e03378dbd4225db5deae4493bc347 (diff)
downloadydb-b942cd0f5ca4da903e5e203a90084fecc88076d0.tar.gz
temporary add library/cpp/streams/factory/open_by_signature to export
e7cda406ffefb716562a9a7ba46607dff026f1c1
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);
+}
+