Added utility for spawning/monitoring/killing processes, fixed reaping of child processes for all Connectors

This commit is contained in:
Thulinma 2011-10-07 02:06:41 +02:00
parent 8c01abba25
commit 6c2ed0e93c
5 changed files with 207 additions and 0 deletions

20
spawntest/Makefile Normal file
View file

@ -0,0 +1,20 @@
SRC = main.cpp ../util/proc.cpp
OBJ = $(SRC:.cpp=.o)
OUT = spawntest
INCLUDES =
DEBUG = 4
OPTIMIZE = -g
CCFLAGS = -Wall -Wextra -funsigned-char $(OPTIMIZE) -DDEBUG=$(DEBUG)
CC = $(CROSS)g++
LD = $(CROSS)ld
AR = $(CROSS)ar
LIBS =
.SUFFIXES: .cpp
.PHONY: clean default
default: $(OUT)
.cpp.o:
$(CC) $(INCLUDES) $(CCFLAGS) $(LIBS) -c $< -o $@
$(OUT): $(OBJ)
$(CC) $(LIBS) -o $(OUT) $(OBJ)
clean:
rm -rf $(OBJ) $(OUT) Makefile.bak *~

15
spawntest/main.cpp Normal file
View file

@ -0,0 +1,15 @@
/// \file spawntest/main.cpp
/// Contains a testing program for the Util::Proc utility class.
#include <iostream>
#include <string>
#include "../util/proc.h" //Process utility
/// Testing program for Util::Proc utility class.
int main(){
Util::Procs::Start("number1", "./test.sh Koekjes");
while (true){
sleep(1);
}
return 0;
}//main

6
spawntest/test.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
echo "I am a test!"
echo "I was called as $0"
echo "My first param is $1"
echo "Exiting now..."