QB64.org Forum

Active Forums => Programs => Topic started by: keybone on April 06, 2022, 05:58:56 pm

Title: spawn and kill processes on linux
Post by: keybone on April 06, 2022, 05:58:56 pm
this code is the beginning of some work i am doing on process management for my GUI project.
This code is for linux only, as it uses shell commands extensively.

This code will do a few things:

1. Get your qb64 program executable's name.
2. Get the PID (Process ID) of your program.
3. Kill your executable's process using the PID.
4. Kill all instances of your executable at once.

using this code you can spawn a child process, get it's PID, and kill it also.

This is just the beginning, and is a work in progress, but i figured id post what i have.
For me spawning and killing the child process was kind of a milestone in this project,

in order to run the code you have to compile some kind of executable to run as client.bas.
compile it before running or change the executable's filename in the shell command.

client.bas :
Code: QB64: [Select]
  1.  

host.bas :
Code: QB64: [Select]
  1.  
  2.