Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:39:52+00:00 2026-06-11T04:39:52+00:00

I’m building a custom Console interface (Windows) in C#. It simply redirect Console’s standard

  • 0

I’m building a custom Console interface (Windows) in C#. It simply redirect Console’s standard input, output, and error to a textbox in WPF application. In the background worker, “cmd.exe” is running, and whenever it outputs anything, that output goes to textbox.

A part of the code is this

private void SetBackgroundWorker()
{
    _worker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true };
    _worker.DoWork += (sender, args) => ReadOutput(_worker);
    _worker.ProgressChanged += (sender, args) => _window.UpdateConsole(args);
}

private void ReadOutput(BackgroundWorker worker)
{
    int count;
    var buffer = new char[1024];
    do
    {
        var builder = new StringBuilder();
        count = _process.Read(buffer, 0, 1024);
        builder.Append(buffer, 0, count);
        worker.ReportProgress(0, builder.ToString());

    } while (count > 0);
}

Then, I can do “git add”, “git status”, or “git commit” commands within this interface (I added the path to git bin directory in PATH), but when I try “git push origin master”, the textbox is not updated. I would expect “Username for ‘…'” and “Password for ‘…'”, but it never happens.

When I do “git push…” in command prompt, it display them, but in my wpf interface, “cmd.exe” doesn’t seem to redirect the output at all, and I’m lost here

One thing I thought I could try was to give up with Redirection, and use Windows api to hook cmd.exe, but it wouild be more complicated.

If you could advise me, I would really appreciate it.

If you want to look at the full code and test it, the code is in https://github.com/andrewchaa/ConsolePlus. It’s in a very primitive stage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:39:54+00:00Added an answer on June 11, 2026 at 4:39 am

    I would imagine that is the application is using something like WriteConsole that writes directly to the screen buffer, there’s no way to intercept that–especially with standard out/standard error redirection. I don’t now specifically what the git application is doing; but it does use colour often, which seems to require use of functions like SetConsoleTextAttribute that also deals directly with screen memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.