process

Process.RedirectStandardOutput does not work

社会主义新天地 提交于 2020-08-27 21:21:46
问题 I have a problem redirecting standard output of an application. It seems like this is some kind of bug in .NET. I'm running Live555ProxyServer but I don't get any output even when console which starts does have a written output. This code works with any other console application but not with this one. void StartProcess() { var process = new Process(); process.StartInfo.FileName = @"live555ProxyServer.exe"; process.StartInfo.Arguments = "-R"; process.StartInfo.UseShellExecute = false; process

Process.RedirectStandardOutput does not work

社会主义新天地 提交于 2020-08-27 21:20:58
问题 I have a problem redirecting standard output of an application. It seems like this is some kind of bug in .NET. I'm running Live555ProxyServer but I don't get any output even when console which starts does have a written output. This code works with any other console application but not with this one. void StartProcess() { var process = new Process(); process.StartInfo.FileName = @"live555ProxyServer.exe"; process.StartInfo.Arguments = "-R"; process.StartInfo.UseShellExecute = false; process

Start detached command with redirect to file

…衆ロ難τιáo~ 提交于 2020-08-19 08:36:26
问题 I'm trying to start a command in a detached process so that it can continue after go program exits. I need to redirect the output of the command to a file. What I need is something like this: func main() { command := exec.Command("/tmp/test.sh", ">", "/tmp/out") if err := command.Start(); err != nil { fmt.Fprintln(os.Stderr, "Command failed.", err) os.Exit(1) } fmt.Println("Process ID:", command.Process.Pid) } Obviously such redirect doesn't work. As I immediately exit from the program after

Printing the priority of the main

被刻印的时光 ゝ 提交于 2020-08-10 18:51:32
问题 I'm wondering if there is a way to print the priority of the main. In this question I asked how to print the deafult priority of a thread; now I'm very curious to know if it's possible to do the same for the main. EDIT: my goal is to get the priority of the unique process I created (I'm using pthread library to create threads inside the int main block). The process should not be a normal process, but a real time process, so i cannot use the getpriority function. It can be used only for normal

Navigating through project directories to call or invoke another program or executable within its own process

牧云@^-^@ 提交于 2020-08-10 13:07:55
问题 I'm working in Visual Studio 2017. In my current solution, I have 2 active projects. The 2nd project depends on the 1st project and my 2nd project is my startup application. When I run or compile my 2nd project, there is already a compiled executable of my 1st project that is within my solutions directory... Here is the directory hierarchy of my solutions - projects: "SolutionName/Project1/" This contains the source code for Project1 "SolutionName/Project2/" This contains the source code for

Send ENTER key to console in form application in VB.NET

左心房为你撑大大i 提交于 2020-08-09 09:44:42
问题 edit: My issue was never quite resolved, but the answer below provided an interesting result. The app will eventually be called by a powershell script and in this situation, I don't have the issue explained below. No additional {ENTER} is required in the PS console, so no more issue! I couldn't care less if an extra ENTER is required when my app is launched manually via cmd.exe Problem: In a VB.NET form app, I'm unable to get the console back to it's "default" state after the code is finished

C# process hanging due to StandardOutput.ReadToEnd() and StandardError.ReadToEnd() [duplicate]

蹲街弑〆低调 提交于 2020-08-08 08:17:52
问题 This question already has answers here : ProcessStartInfo hanging on “WaitForExit”? Why? (22 answers) Hanging process when run with .NET Process.Start — what's wrong? (5 answers) Closed 2 years ago . For processes with a lot of output or error, trying to redirect standard output and error with a simple string output = process.StandardOutput.ReadToEnd(); string err = process.StandardError.ReadToEnd(); process.WaitForExit(); will cause the program to hang, and never actually finish. 回答1: As it

using WIN32 API CreateProcessAsUser in Python

北城以北 提交于 2020-08-01 09:13:11
问题 I have been trying to find a good example of how to use the CreateProcessAsUser() WIN32 API in Python along side the LogonUser() API, but to no avail. Any help on this would be greatly appreciated. 回答1: First, you should know that the Python extensions for Windows API is closely mapped to the Windows API. In this use case, the following links should prove very useful to you: Discusses LogonUser() function http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184(v=vs.85).aspx Discusses

using WIN32 API CreateProcessAsUser in Python

心已入冬 提交于 2020-08-01 09:12:20
问题 I have been trying to find a good example of how to use the CreateProcessAsUser() WIN32 API in Python along side the LogonUser() API, but to no avail. Any help on this would be greatly appreciated. 回答1: First, you should know that the Python extensions for Windows API is closely mapped to the Windows API. In this use case, the following links should prove very useful to you: Discusses LogonUser() function http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184(v=vs.85).aspx Discusses

Monitor new processes as a non-admin

六月ゝ 毕业季﹏ 提交于 2020-07-20 05:43:10
问题 There is a very clear answer here on how to monitor processes. It works like a charm... except it must be run in elevated mode, which is a definite non-option for me in the context of my program. What I need to do is basically monitor all new processes and compare them against a predetermined list. I would like to do this without simply using a stopwatch and polling for any new processes. Does anyone know of an event that would be raised similar to the ManagementEventWatcher that doesn't