Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [child-process]

For code that manages processes (child processes) spawned by other processes (parent processes).

1
vote
0answers
28 views

Spawning multiple child processes to preview Vue.js projects

Context: I'm making a Codepen-like app but I want it to support sophisticated JS libraries/frameworks like Vue or Angular 2+ for example. I want to have a live preview of my snippet which updates in a ...
0
votes
1answer
22 views

A D wrapper around a C function

Any problems with this D wrapper around libcomcom_run_command() C function from C library libcomcom? Does it work as expected? Is it idiomatic? Is it the right way ...
8
votes
3answers
186 views

Executable wrapper around Perl script on Windows

I have ack (the searching tool) "installed" as a single file at C:\ack\bin\ack.pl on a Windows 10 machine and was wondering how to make it executable from the ...
4
votes
1answer
40 views

CLI helper in Rust

This is my first hands-on experience with Rust. The program actually works and I really like how it functions. I'm just very interested in what code improvements I could do. I wrote an application in ...
1
vote
2answers
46 views

Running shell script as root via external binary

I'm not an experienced Linux user and I wanted an easy way to run shell scripts as root from a PHP script, I came up with this: ...
2
votes
0answers
58 views

VIm function that runs file through shfmt

I've written a Vim function that formats the file using shfmt. I'd like to know if there is a way I can improve this script. I am bothered by the fact that I can't think of a way to do this without ...
0
votes
0answers
85 views

An `async..await` based way to handle the output of a child process

I've recently answered a question on Stack Overflow where the asker was wondering how to read from the standard out of a child process he was spawning inside a ...
3
votes
1answer
96 views

Running xinput to change touchpad settings

I am looking for some feedback on the code below, mainly for efficiency or mechanism correctness (like eval vs. subprocess). I am also curious if ...
17
votes
2answers
1k views

Yet another shell in C

I wrote this shell in C about a semester ago for a university assignment on operating systems. Even though I got a score of 10/10 in this assignment, I doubt it deserved it - The pipeline ...
1
vote
3answers
137 views

Send command and get response from Windows CMD prompt silently - follow-up

This post is an updated version of the original post, with the code examples below reflecting changes in response to very detailed inputs from user @pacmaninbw. The updated source examples below also ...
5
votes
2answers
247 views

Python program that pings and outputs a response in Tkinter

I have a program that allows me to check (in a nicer way than using command prompt) what my ping will be when playing League Of Legends. I've implemented all of the elements that I had hoped, however ...
4
votes
1answer
188 views

Subprocess CSV validator and multiprocessing on Python

This Python script takes a directory of CSV files and calls a Scala script which tests whether a file's contents match a given regular expression. The link to this Scala script can be found in the 3rd ...
3
votes
2answers
3k views

FFMPEG with Java Wrapper

In this java application, I am trying to convert an video into small clips. Here is the implementation class for the same ...
3
votes
1answer
50 views

Periodically run Bash Job A to conditionally restart Bash Job B based on output of Bash Job A

Is there any neater way I can accomplish the task (as in title)? Also, I'm not sure why asyncio.Task.all_tasks() explodes and whether this is bad or not. ...
5
votes
0answers
529 views

Start a sub-process (with sudo) as head of new process group, kill it after timeout, get the output

This is a bit of a tricky one ... I am writing a test suite for a Python project - running on Linux. As part of the tests, I have to fire up various commands (shell commands, small CLI tools, Perl ...
2
votes
2answers
99 views

Parse output of Google Cloud command into PHP associative array

This is my idea on how to turn Shell exec output in PHP to array output. I just want to share it and get feedback in case there is any better way. Below is a code example to get server info from GCE. ...
2
votes
1answer
2k views

C++ wrappers for execv(3)

Calling execv(3) (and similar functions) in C++ can be problematic. execv expects an array of const pointers to non-const ...
6
votes
2answers
282 views

Safely open a list of links in Firefox

I receive a list of links via http and I want to open them all in a new Firefox (or default browser) window as tabs; that is my script must not touch existing windows. This is the best solution I ...
1
vote
1answer
872 views

Java executing rSync shell command with progress display

I basically want to write a simple GUI program to sync to directories using the rsync command. The core part of the code is below. My main question is, do I need to ...
6
votes
1answer
772 views

Avoiding shell injection when calling Git in Python

I'm developing a command line application in Python which processes information that users provide. I've been reading the Python documentation on this topic and found that the built-in module ...
4
votes
1answer
100 views

Analyzing the color composition of a video

Here is a snippet of code from a project I have been working on that can be found here. I am looking for suggestions on how I can improve my code to make it cleaner and maybe improve performance. <...
8
votes
2answers
3k views

Parsing the lsblk output

I am a Python beginner learning Python 3. I have written two small functions that parse the lsblk output and return Linux physical and logical disks. Here is the first function: ...
3
votes
1answer
148 views

BASH script to monitor subprocess and throttle it for CPU temperature control

I need to run CPU-intensive tasks on a very old machine with overheating issues. The script below will monitor temperature and pause the jobs when it gets too high, continuing them when it's back to ...
4
votes
0answers
733 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 while it's running. With the logging module I get timestamps ...
2
votes
0answers
395 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, ...
3
votes
1answer
168 views

Killing and restarting processes

I am a beginner with Erlang and currently making my way through the awesome Joe Armstrong's book. The following are my answers to exercises 5 and 6 for the concurrency chapter. The code can probably ...
3
votes
2answers
78 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
1answer
8k views

Python Executer that kills processes after a timeout

Imagine you want to run a bunch of tasks in parallel, but you can't be sure that all of your tasks will eventually terminate or rather decide to eat up all your memory and CPU time. This should be ...
15
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
45 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
1k 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
106 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 ...
4
votes
1answer
5k 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
1k 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
413 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
724 views

Interactive command line YouTube downloader with option to burn subtitles into video

EDIT: This code is now public on GitHub with more focused purpose in case anyone is interested. Thanks for the help! This is only used on Mac machines. I know that there is a Python implementation ...
5
votes
1answer
664 views

Killing a tunnel and establishing a tunnel through SSH

I have two functions right now: ...
3
votes
1answer
51 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
2k 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
2k 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
101 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
1k 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
299 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
2k 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 ...
5
votes
1answer
1k 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
2k 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. <...
8
votes
1answer
1k 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
1k 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
70 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
589 views

Running alarms in python

My code is designed to simply trigger alarms; it is not supposed to be used by anyone but me. ...