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 6081333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:09:48+00:00 2026-05-23T11:09:48+00:00

I am making a call to ffmpeg. Sometimes the call fails and ffmpeg wont

  • 0

I am making a call to ffmpeg. Sometimes the call fails and ffmpeg wont exit it will just enter a recursive loop. I have called the WaitForExit mthod.

Further on in the code I am interrogating the standardOutput and standardError. I know that when ffmpeg doesnt exit it produces alot of garbage on the console screen. For that reason I believe when I try and get the standardOutput and standardError the c# code just crashes. Its still being written to. How can I tell if c# has exited the code rathar than the process exiting on its own?

I have tried to look at process.HasExited but it doesnt work. Even though I know c# has exited the process it still comes up as false.

            p.StartInfo.FileName = exePathArg;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.Arguments = argumentsArg;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.CreateNoWindow = true;

            p.Start();

            p.WaitForExit(timeToWaitForProcessToExit);

            StreamReader standardOutput = p.StandardOutput;
            StreamReader standardError = p.StandardError;

            retDirects.Add("StandardOutput", standardOutput.ReadToEnd());
            retDirects.Add("StandardError", standardError.ReadToEnd());
  • 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-05-23T11:09:49+00:00Added an answer on May 23, 2026 at 11:09 am

    You might not be able to tell unless the process provides some sort of output or error code. You can look at the ExitCode using:

    p.ExitCode

    The error code is provided by the application, so you’ll also have to be aware of what values it might return.

    In some cases if the process is killed (e.g. via task manager, ExitCode may be 1, see this answer).

    Update

    After our exchange in the comments, it seems that there were some other issues to address:

    If you’re confident that the process is actually in an unresponsive state, then killing the process is a good last resort. There are two ways to “kill” a process with the Process class:

    • Process.Kill() – terminate the process (and possibly corrupt data)
    • Process.CloseMainWindow() – sends close message to the main window (only GUI procs)

    If you have a process with a graphical interface, you should use CloseMainWindow(). CloseMainWindow() is essentially the same thing as clicking the exit button on a window, so it is safer because it actually asks the program to shut itself down. Note that the process might not actually respond to CloseMainWindow, either because it is unresponsive or because it chooses not to, so you may have to use Kill() afterwards if that happens.

    If your process doesn’t have a graphical interface, Kill() is the only way to do it.

    However, as you asked in the comments about using both, you shouldn’t do that unless you tried to use CloseMainWindow() and that didn’t work.

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

Sidebar

Related Questions

I have a main page from where I am making a call to load
I have a windows service that is making a call out to an IIS
I am making a call to a method by passing ipAddress and it will
We have an enterprise application where we are making a call to Database 1,
I have a page on my website that I am making a call to
I have a problem that is surely familiar to many: I'm making a call
do Apple support for making a conference call? I have search alot but have
I have a view that lives in /Views/Projects and I am making a call
I have users making ajax call while typing. The problem is that it makes
I'm making call to Alfresco Webscripts which return JSON. I do this using GET

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.