process

C signal handler getting activated by all child processes

本秂侑毒 提交于 2020-01-25 21:27:28
问题 I need some kind of signal_handler that when pressed CTRL+C, the program pauses all it's operations and asks the user: «Are you sure you want to terminate(Y/N)?» If the answer is y, the program terminates, if it's n the program continues/prooceeds with it's functions, this is what i have till this moment: void sig_handler(int sig){ if(sig == SIGINT){ char res; printf("\nAre you sure you want to terminate (Y/N)?\n"); kill(0, SIGTSTP); //envia sinal Stop ao processo pai do{ read(STDIN_FILENO,

Handle events from another application

不想你离开。 提交于 2020-01-25 06:13:45
问题 Hellu The question is simple, yet the answers seem to be various and pretty unclear. How can I, in an application A, handle events sent by an application B, and how to implements those events in B? Knowing that B has no idea of the existence of A. Let's say B is a "batch-like" type of program, doing things in the back with no graphical display whatsoever, and A is the nice GUI (pun intended) that should write messages B sends him in a dialog or something. I found interesting answers about

Handle events from another application

本小妞迷上赌 提交于 2020-01-25 06:11:28
问题 Hellu The question is simple, yet the answers seem to be various and pretty unclear. How can I, in an application A, handle events sent by an application B, and how to implements those events in B? Knowing that B has no idea of the existence of A. Let's say B is a "batch-like" type of program, doing things in the back with no graphical display whatsoever, and A is the nice GUI (pun intended) that should write messages B sends him in a dialog or something. I found interesting answers about

Can we use process.hrtime() as UUID in node.js?

房东的猫 提交于 2020-01-25 05:00:06
问题 Can we use process.hrtime() as universal unique id within the current process ? var uuid = parseInt(process.hrtime().join('')); 回答1: You can use process.hrtime() to create identifiers with low chance of collision, but they are not unique, especially not across application restarts (which matters if you persist any of them to a database or similar), and not when several threads/processes/instances are involved. From the documentation: These times are relative to an arbitrary time in the past,

Implement wait between processes in Java?

拜拜、爱过 提交于 2020-01-24 10:46:49
问题 I would like some help understanding and implementing a 'wait until process complete' between the various processes in my application, which need to proceed in a step-wise fashion . My java file runs a batch file which then runs a script. At the conclusion of this there are series of commands that I need to run (through the command line) in a consecutive manner. I'm using: Runtime.getRuntime().exec("cmd /c start " + command) to run my batch files and commands (not sure if that information is

C Fork and Pipe closing ends

孤街浪徒 提交于 2020-01-24 00:22:31
问题 I am building an application that requires two way communication with a few child processes. My parent is like a query engine constantly reading words from stdin and passes it to each child process. The child processes perform their processing and writes back to the parent on their exclusive pipes. This is theoretically how it should work however I am stuck on the implementation details. The first issue is do I create 2 pipes before forking the child? When I fork, I know the child is going to

How to determine the date-and-time that a Linux process was started?

心已入冬 提交于 2020-01-23 21:12:19
问题 If I look at /proc/6945/stat then I get a series of numbers, one of which is the number of CPU-centiseconds for which the process has been running. But I'm running these processes on heavily-loaded boxes, and what I'm interested in is the clock-time when the job will finish, for which I want to know the clock-time that it started. The timestamps on files in /proc/6945 look to be in the right sort of range but I can't find a particular file which consistently has the right clock-time on it. As

Process.Start(“microsoft-edge:”) gives me Win32Exception

家住魔仙堡 提交于 2020-01-23 09:32:54
问题 When I execute the following line of code: Process.Start("microsoft-edge:"); Or Process.Start("microsoft-edge:http://localhost"); It gives me this error: System.ComponentModel.Win32Exception: 'The system cannot find the file specified.' When I run microsoft-edge: using Win + R it works. I'm using .netcore 3.0.0-preview6-27804-01 Any idea why this is happening? Edit: These are not working either: Process.Start(@"c:\Windows\System32\LaunchWinApp.exe:http://localhost"); Process.Start(@"http:/

Process.Start(“microsoft-edge:”) gives me Win32Exception

被刻印的时光 ゝ 提交于 2020-01-23 09:32:28
问题 When I execute the following line of code: Process.Start("microsoft-edge:"); Or Process.Start("microsoft-edge:http://localhost"); It gives me this error: System.ComponentModel.Win32Exception: 'The system cannot find the file specified.' When I run microsoft-edge: using Win + R it works. I'm using .netcore 3.0.0-preview6-27804-01 Any idea why this is happening? Edit: These are not working either: Process.Start(@"c:\Windows\System32\LaunchWinApp.exe:http://localhost"); Process.Start(@"http:/

Force StandardOutputEncoding to UTF8

送分小仙女□ 提交于 2020-01-23 07:35:29
问题 I'm looking to parse UTF8 characters from the standard output stream of another application in my C# project. Using the default approach, characters outside of the ANSI spectrum are corrupted when read from the process' standard output stream. Now according to Microsoft, what I need to do is set the StandardOutputEncoding: If the value of the StandardOutputEncoding property is Nothing, the process uses the default standard output encoding for the standard output. The StandardOutputEncoding