Skip to content

Conversation

@Shulelk
Copy link

@Shulelk Shulelk commented Apr 29, 2024

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

@flozz
Copy link
Owner

flozz commented May 14, 2024

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 :)

@Shulelk
Copy link
Author

Shulelk commented May 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants