天道酬勤,学无止境

process

Clarification on calling CreateProcessAsUser with command line parameters using C++

I'm somewhat confused about the proper way of calling CreateProcessAsUser with command line parameters. So without going into details of filling out the rest of its parameters, can someone confirm that this is how it should be done? (In other words, should I put the exe file path as the first command line parameter, or specifying it as lpApplicationName is enough?) LPCTSTR pExePath = L"c:\\program files\\sub dir\\program.exe"; LPCTSTR pCmdLine = L"v=\"one two\""; TCHAR buff[MAX_PATH]; StringCchCopy(buff, MAX_PATH, _T("\"")); StringCbCat(buff, MAX_PATH, pExePath); StringCbCat(buff, MAX_PATH, _T

2021-06-15 16:06:36    分类:问答    c++   winapi   process

How to get pid of process executed with system() command in c++

When we use system() command, program wait until it complete but I am executing a process using system() and using load balance server due to which program comes to next line just after executing system command. Please note that that process may not be complete. system("./my_script"); // after this I want to see whether it is complete or not using its pid. // But how do i Know PID? IsScriptExecutionComplete();

2021-06-15 14:58:14    分类:问答    c++   process   pid

Reading other process console output

I have problem when console output is returned in 'waves'. For example console outputs something every second, and for example event triggers 60 times every minute (all events at he same time). My code: Process Proc = new Process(); Proc.StartInfo.FileName = SSMS.BinaryDir + "HldsUpdateTool.exe"; Proc.StartInfo.Arguments = "-command update -game tf -dir " + SSMS.RootDir + Key; Proc.StartInfo.UseShellExecute = false; Proc.StartInfo.RedirectStandardOutput = true; Proc.StartInfo.RedirectStandardError = true; Proc.EnableRaisingEvents = true; Proc.StartInfo.CreateNoWindow = false; Proc

2021-06-15 14:42:16    分类:问答    c#   process   console

MPI - Asynchronous Broadcast/Gather

I have a project which requires 'n' number of processes to work until the problem is solved. Each slave process executes the same code. When a certain condition arises, the process needs to notify all of the other processes in a non-blocking way. The other processes also need to receive this message in a non-blocking way. Is there a way to do with without threading a separate loop?

2021-06-15 13:41:50    分类:问答    c++   process   mpi

the only overhead incurred by fork is page table duplication and process id creation

The only overhead incurred by fork() is the duplication of the parent’s page tables and the creation of a unique process descriptor for the child. In Linux, fork() is implemented through the use of copy-on-write pages. Copy-on-write (or COW) is a technique to delay or altogether prevent copying of the data. so why is there a need to copy page tables . as long as the processes share the pages in read only mode or until they write something there is no need that the page tables need to be copied because the translation is the same for both the parent and child?? can someone please explain

2021-06-15 08:34:30    分类:问答    linux   process   operating-system   kernel   fork

Get running process' stdin/stdout with node.js

I am starting a process from node with child_process.spawn and handling process.stdout/stderr data events, and writing to stdin. Now, my node application may crash or get stopped, when it is restarted I find the process by it's PID, and then I would like to attach again to the process' stdin/stderr/stdout. The process in question could be any daemon-like program, so I do not have control over it's behaviour (I cannot set up the process to redirect it's stdio upon receiving a signal, for example). I am thinking wrapping the process using screen, redirecting stdio to a FIFO file (but the

2021-06-15 06:41:46    分类:问答    node.js   process   stdio

How to disable Open file – Security warning

I have a weird question. I have written a winform server application and a winform client application. The role of the client is to send commands for running a certain script to the server. The server receives those commands, parses them, and runs them. These two work great. I have written a cmd application which uses some of the functions from my client. This application is supposed to function as a cmd client. The question is this: When I run the winform client, the server runs the commands with no problems at all. When I run the cmd client, when the server attempts to execute the received

2021-06-15 06:09:11    分类:问答    c#   winforms   process   client-server   console-application

Write to stdin of a running process in windows

I want to write data to an existing process's stdin from an external process in Windows. I found similar questions for Linux, but I want to know how I can do the same in Windows. How to write data to existing process's STDIN from external process? How do you stream data into the STDIN of a program from different local/remote processes in Python? https://serverfault.com/questions/443297/write-to-stdin-of-a-running-process-using-pipe I tried with this code but I got an error. I also tried running the program, sending stdin to that with this code, but again, it errored. In CMD: type my_input

2021-06-15 04:13:52    分类:问答    c#   python   process   cmd   stdin

How to stop bash from creating subshells when recursively call a function

This is a simple shell function to calculate factorial. #!/bin/bash function factorial() { if (( $1 < 2 )) then echo 1 else echo $(( $1 * $(factorial $(( $1 - 1 ))) )) fi } factorial $1 But I find that this script will create many sub-shells when given a very big input. It is not necessary and not efficient. Is there any way to call recursive functions without creating new sub-shells? My goal is not how to write a factorial function in shell, but how to avoid creating sub-shells when call recursively defined functions. In fact, even a simple function call will cause creation of sub-shells: #

2021-06-15 03:49:19    分类:问答    bash   shell   recursion   process

Node.js Child Process Issue with Args - Quotes Issue?, FFMPEG issue?

I need to be able to execute FFMPEG from my Node.js application. I believe this problem likely has to do with properly specifying command line arguments, and not specific to FFMPEG, but as I have been unable to narrow down the issue, I present my entire problem. I can execute the following command from the command prompt successfully: C:\Brad\ffmpeg.exe -f dshow -i audio="Microphone (SoundMAX Integrated" testaaa.mp3 FFMPEG starts as expected, records audio from my audio device, and writes an MP3 file. Now, I try to do the same thing within my Node.js application: childProcess = child_process

2021-06-15 03:03:35    分类:问答    node.js   command-line   process   ffmpeg   command-line-arguments