p0wny-shell icon indicating copy to clipboard operation
p0wny-shell copied to clipboard

Add pcntl to exec

Open Shulelk opened this issue 1 year ago • 2 comments

If the target has the pcntl extension installed, then you can use the pcntl_exec funtion to execute system commands.

Shulelk avatar Apr 29 '24 03:04 Shulelk

Hello,

I have some remarks and things I do not understand well in your PR:

  1. What is the purpose of the $commandFile as it is never executed?
  2. Why forking the process with pcntl_fork() here? I think we want to block the main process until the command has finished its execution.
  3. Why sleeping two seconds? Is it to wait for the command inside the forked process to finish its execution? What happens if it takes more than 2 seconds to complete?
  4. This code will work only on Unix-like systems (Linux, BSD,...), it will fails on Windows. A check must be added to be sure to run in a supported environment.

I think we should rework your PR before being able to merge it :)

flozz avatar May 14 '24 15:05 flozz

The pcntl module does not support Windows, which means that the corresponding functions cannot exist on the Windows platform.

Shulelk avatar May 16 '24 10:05 Shulelk