#console #terminal #winapi #named-pipe #windows

bin+lib pipedconsole

Easily manage multiple windows consoles from one single process

7 releases

0.3.2 Feb 1, 2023
0.3.1 Jul 24, 2022
0.3.0 Sep 9, 2021
0.2.3 Sep 8, 2021
0.0.4 Jun 16, 2021

#115 in Windows APIs

27 downloads per month

MIT license

42KB
535 lines

Pipedconsole

A rust crate for managing multiple consoles from one windows application.

Normaly a program running on windows can only use one console.

A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console.

From the microsoft docs.

This crate solves this problem by providing an abstraction over a worker process wich is controlled using named pipes.

Usage

You can use the Console class to create a new console, after that you can write to it or read a line.

use pipedconsole::Console;

let console = Console::new("My Console").expect("Failed to create a new console");
console.println("What is your name?").expect("Failed to call println"); // a seperate console window

let mut name = String::new();
console.read_line(&mut name).expect("Failed to read from the console");
println!("Your name is: {}", name); // main processe's console

Documentation and download

Download the crate either directly through Cargo or visit crates.io. More documentation can be found on docs.rs.

Changelog

0.3.1 -> 0.3.2

  • Fixed docs.rs again, I just forgot to change a function name

0.3.0 -> 0.3.1

  • Rewrote the message passing system
  • Improved documentation
  • Minor bug fixes for the build help messages

0.2.3 -> 0.3.0

  • Implemented std::io::Write for console. This means the flush method is now part of that trait.
  • Fixed documentation.

0.2.0 -> 0.2.3

  • New system for building the console_worker executable. It is easier to use and comes with auto detection for the executable. Note: The documentation on the root page is slightly wrong in this version.

0.0.0 -> 0.2.0

  • Got docs.rs to work correctly.

Dependencies

~225KB