Author Topic: spawn and kill processes on linux  (Read 5884 times)

0 Members and 1 Guest are viewing this topic.

Offline keybone

  • Forum Regular
  • Posts: 116
  • My name a Nursultan Tulyakbay.
    • View Profile
spawn and kill processes on linux
« 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.  

« Last Edit: April 14, 2022, 08:08:28 am by keybone »
I am from a Kazakhstan, we follow the hawk.