**How to reproduce**
```
for i in {1..1000}; do echo 'Hello, world!' | clickhouse-local --query "SELECT * FROM table" --structure 's String' | wc -c; done
```

This script hangs.
parent_folder = std::filesystem::temp_directory_path();
        }
        catch (const std::filesystem::filesystem_error& e)
        {
            
            LOG_DEBUG(log, "Can not get temporary folder: {}", e.what());
            parent_folder = std::filesystem::current_path();
            std::filesystem::is_directory(parent_folder); 
            LOG_DEBUG(log, "Will create working directory inside current directory: {}", parent_folder.string());
        }
        
        
        
        
        default_path = parent_folder / fmt::format("clickhouse-local-{}-{}-{}", getpid(), time(nullptr), randomSeed());
        if (exists(default_path))
            throw Exception(ErrorCodes::FILE_ALREADY_EXISTS, "Unsuccessful attempt to create working directory: {} exist!", default_path.string());
        create_directory(default_path);
        temporary_directory_to_delete = default_path;
        path = default_path.string();
        LOG_DEBUG(log, "Working directory created: {}", path);
    }
    if (path.back() != '/')
        path += '/';
    global_context->setPath(path);
    global_context->setTemporaryStorage(path + "tmp");
    global_context->setFlagsPath(path + "flags");
    global_context->setUserFilesPath(""); 
}
static void attachSystemTables(const Context & context)