For code that manages processes (child processes) spawned by other processes (parent processes).
3
votes
0answers
81 views
subprocess with logging module: tee with StringIO
I've got a long-running process. Once it finishes I need the output. But the user should be informed as its running. With the logging module I get timestamps and ...
2
votes
0answers
29 views
Golang nanny process starting child process
The idea here is that my executable can be started normally (in which case it runs my business logic), or it can be wrapped in a nanny process (which starts a child process to run the business logic, ...
5
votes
1answer
30 views
Erlang: Killing and restarting processes
My first post here so hopefully won't screw up that badly :-)
I am a beginner with Erlang and currently making my way through the awesome Joe Armstrong's book.
The following are my answers to ...
3
votes
2answers
35 views
Python 'wrapper' around `dig` for easier TSIG signing of queries
I wrote this Python script as a utility script for me. It's something that could be achieved in a simple shell script or alias, but it wasn't 'verbose' enough for me in that format, or customizable.
...
14
votes
5answers
1k views
Printing the PID of a program immediately before it runs
I need to know (for monitoring purposes) the PID of a program immediately before I start it. There could be multiple of the same program launched at the same time, so monitoring ...
1
vote
1answer
12 views
Start a process in Elisp
How can the following code be made idiomatic in ELisp? Can the temporary f variable be removed?
...
2
votes
1answer
66 views
Read output from a subprocess executed by Python
I've written these 2 methods and I'm wondering if the 2nd method, which uses yield is more efficient or if I'm using yield wrong. Can someone refactor the 2nd method to make it more efficient for ...
5
votes
1answer
81 views
run command pipeline in C
This code parses and tokenizes my shell language command interpreter. I will try and make it 2 functions, one that is the tokenizer and the other that is the rest of the function. Can you find ...
3
votes
1answer
590 views
Peterson's Algorithm (Mutual Exclusion)
A simple algorithm that can be run by two processes to ensure mutual exclusion for one resource.Shared variables are created and initialized before either process starts. The shared variables flag[0] ...
0
votes
1answer
154 views
Spawning child processes and event-listening
This function scrapes data from a webpage by spawning a process that executes a CasperJS web scraping script. The spawned process outputs data to stdout.
This ...
2
votes
0answers
126 views
A two-method program for running background jobs
Edit: since originally posting this I have: realized that it won't run from irb/pry, and refactored to remove some sleep calls. I've also separated the sections ...
2
votes
1answer
221 views
Interactive command line YouTube downloader with option to burn subtitles into video
This is only used on Mac machines. I know that there is a Python implementation of youtube-dl and several for ffmpeg, however I chose to use subprocess so that I can see the real-time stdout/stderr ...
5
votes
1answer
85 views
3
votes
1answer
41 views
Getting a list of outdated versions with Python
I have a list of boxes and need to list only the outdated ones.
For example, input will look something like this:
...
4
votes
3answers
538 views
NTP Clock on a Raspberry Pi
I've been tinkering around with making a fancy clock on a Raspberry Pi B. This little application will sync the Pi's time with an NTP server, then display it using ...
1
vote
1answer
825 views
Accessing Wi-Fi network interface details from Java using netsh
I am developing a Java program on Windows. I want to access Wi-Fi interface details such as SSID, IP, subnet, enabled or not, connected or not and so on. I am currently trying with using netsh and ...
6
votes
2answers
81 views
Python code to run a C program that calculates whether points are in the mandelbrot set
This is part of a project to explore the Mandelbrot set. The code to graphically navigate the complex plane and allow the user to adjust the colormap and number of iterations is all written in Python, ...
4
votes
1answer
102 views
OutputStream class for use with subprocess.Popen
I've recently been writing an application which does a lot of work with the output of commands. To call the commands I've been using the subprocess module, and originally, was using ...
4
votes
2answers
288 views
forever.sh - should keep a process alive forever
This script's only responsibility is to keep a process alive. Forever.
It's sole dependencies shall be bash and coreutils. I'm ...
3
votes
2answers
364 views
WIFEXITED combined with WIFSIGNALED
I am testing the WIFEXITED to see if a child process exited abnormally or normally. According to documentation, it should return a non-zero status for a child ...
4
votes
1answer
369 views
Generating a thumbnail collage of videos
Just came home from a vacation, and I have a bunch of GoPro videos that I want to compile into a fun music video. In order to support this process, I wanted to write a script that would take all my ...
6
votes
3answers
614 views
Locating a PID based on an IP address and port
I wrote a simple Python app that is given an IP address and port and the app then finds the PID listening on that IP:PORT.
I would like to hear constructive criticism regarding the bellow code.
<...
7
votes
1answer
574 views
Freeing shared memory with a signal handler
I have a homework question that asks me to get 2 integers from the user, put them in shared memory, fork a child, have the child add them and put the result in shared memory, and then the child will ...
6
votes
2answers
302 views
Logger module in child processes from os.fork()
I have had a hard time understanding all the documentation on the logger module and forking processes.
My goal is to have each child process that's worked to write to their own separate log file.
...
4
votes
2answers
62 views
Return from the parent process code or common code
In this program, the parent process creates a child process, then the child executes ls -l. The parent process waits for the child process to complete and then ...
2
votes
1answer
130 views
Running alarms in python
My code is designed to simply trigger alarms; it is not supposed to be used by anyone but me.
...
1
vote
1answer
884 views
Running async processes in node.js on multiple cores
Using the async and child_process modules, I can create true "parallel" processing. My question is, how can I ensure that it is ...
4
votes
2answers
541 views
A simple fork with an ugly waitpid
This is my first take on fork, exec and waitpid. I didn't quite understand why I had to use ...
1
vote
1answer
347 views
Python script that launches a process that it needs to clean up after and kill on receiving SIGTERM/SIGINT
I'm using a Python script to run a particular program that occasionally may need to be terminated (by receiving a SIGINT or SIGTERM) in which case a clean up process needs to be invoked (before ...
4
votes
1answer
1k views
The right way to use IPC::Open3 in Perl
Here is the function which does exactly what is specified by its name:
...
3
votes
1answer
71 views
Erlang handling errors in concurrent programs
I have two tasks:
Write a function that starts and monitors several worker processes. If any of the worker processes dies abnormally, restart it
Here is the code that I built:
...
5
votes
2answers
397 views
Use git to get SHA-1 of repo
I've created the function below to get the SHA-1 of the repository used by my CI server. The hash is then used to update the pass/fail status of the commit on GitHub.
I'm a python amateur. What ...
1
vote
0answers
617 views
Handling output and exit codes of processes
For a large, multi-threaded video processing application, I need to manage various child processes. I need to monitor their stdout and stderr.
My key concerns:
I should not have any spin loops. I ...
7
votes
1answer
69 views
Restrictive stupid shell
I'm attempting to create a replacement shell for /bin/bash, that only permits commands defined by a read only config file. These commands will be run by absolute paths, and take no arguments. I'm not ...
3
votes
1answer
479 views
Python script that does a git diff
I have created a small script that aims on comparing two versions of a file by doing a git diff. Is there a better way to code it?
...
4
votes
3answers
2k views
Searching for a string in a downloaded PDF
This code goes to the website containing the PDF, downloads the PDF, then it converts this PDF to text. Finally, it reads this whole file (Over 5000 lines) into a list, line by line, and searches for ...
7
votes
1answer
70 views
Compile .tex and remove .div file from Haskell
As a practice for interacting with system commands, I wrote a Haskell program that compiles a .tex file specified by the argument.
When one execute this program:
If no argument is specified, print <...
6
votes
2answers
2k views
Function to grab stdin, stdout, stderr of a child process
I've managed to create a function to pipe the stdin, stdout and stderr of a child process ...
1
vote
0answers
69 views
Using an asynchronous function without directly using its callback
I hate functions and re-writing callbacks by "intercepting" them and passing the original along. This is simple: it uses an existing function, exec, and doesn't ...
4
votes
1answer
272 views
Simple One Way IPC Implementation for pcntl_fork
It is a common task for me to need to run many nearly identical child processes. Not often but sometimes I need those child processes to communicate their results back to the parent process. I have ...
5
votes
1answer
132 views
Haskell program to turn off computer
This a program I wrote to execute various power-related function on my computer. It accepts one command-line argument that describes what action to take and then performs that action. Usage looks like ...
7
votes
1answer
444 views
Simple, encapsulated C++ logger that can deal with fork/exec situations
Motivation: for whatever reason, some of the available 3rd party logging libraries don't really deal with programs that get fork'ed/exectuted well. For instance, ...
7
votes
1answer
102 views
Changing desktop background to the next available one
How could I improve this working Perl script, which changes my desktop background to the next available one, without opening a terminal? Specifically, how could I iterate over my .fehbg and walls/ ...
7
votes
3answers
12k views
Simple shell in C [closed]
I am just getting started with C and made this simple shell to test my understanding of some basic principles. The shell reads commands from standard input, forks itself and executes the command. How ...
4
votes
1answer
373 views
Text parsing and calculator (calculate Java heap memory)
I'm writing small tool, which must execute jmap -heap, write output to log, then takes some data from log and calculate used memory.
I added some ...
15
votes
2answers
368 views
Interprocess Communication in a Farmer-Worker setup
The following code is my first C program I have made for an university assignment about Interprocess Communication. This involved creating a parent process, the farmer, and then creating a certain ...
5
votes
3answers
68 views
Structuring code that shells out to an external script
This code that shells out to an external script could use some input in order to read smoother, I think. Praise and critique are welcome.
...
2
votes
1answer
1k views
Await and interactive Android ADB shell
I'm writing an app to let me interact and debug my android over USB using the android SDK and the ADB command. I create a Process with redirected input and output streams and basically run "ADB shell"...
6
votes
2answers
293 views
Displaying a scheduled job under a scheduled time
I use at to schedule jobs and atq to display the scheduled jobs. But it mildly irritates me in that I have to look up each job ...
7
votes
2answers
416 views
Movie-making script
The purpose of making this code is to copy/paste and run it (and it should run). I'm open to all feedback.
...