Questions tagged [symfony-process]

Symfony Process component executes commands in sub-processes.

Symfony Process is one of the Symfony components that is bundled with Symfony but can also be used separately.

It allows to run sub-processes, view real-time process output, run them asynchronously, kill them with nice API.
Also it can be used to run PHP code in isolation.

Documentation:
http://symfony.com/doc/current/components/process.html

Install using Composer:
composer require symfony/process

Homepage:
https://github.com/symfony/process

102 questions
1
vote
1 answer

How to get the memory usage of a script that runs via symfony-process?

So, here's this wep-app, happily running python scripts, queued via messages, with the Symfony Process component: $stopwatch = new Stopwatch(); $stopwatch->start('cmd'); $process = new Process($somePythonCmd, null, ['PYENV_VERSION' =>…
gherkins
  • 14,603
  • 6
  • 44
  • 70
1
vote
1 answer

Symfony process run throws exception - executing on command line works

I have an issue with generating PDF files using LaTeX. The solution is created with the Laravel framework (version 8). I installed a new "Windows 2019 Datacenter" server, where the website should later be hosted on. On the server the command to…
dns_nx
  • 3,651
  • 4
  • 37
  • 66
1
vote
1 answer

How do I pass a wildcard GLOB to rsync wrapped by Symfony Console?

What I want to do I want to move all XML files from /source/ to /target/ How I try to do it rsync -avz --remove-source-files /source/*.xml /target/ I am using the Symfony Process / Console Component as a wrapper for rsync. Process Component…
1
vote
0 answers

Unittesting a Symfony 4.2 process runs infinite loop (than times out), wihout unittest it works fine

Lets say I have the following Symfony 4 command: class Command1 extends Command { protected static $defaultName = 'app:command1'; protected function execute(InputInterface $input, OutputInterface $output){ $process = new…
CSiPet
  • 11
  • 2
1
vote
1 answer

Symfony Process Progressbar with git clone

I am using Symfonie's Process components, I am running a git clone command and would like to show a progressbar of it So far I have done this: protected function cloneRepo(String $name) { $process = new Process( "git clone…
Jon not doe xx
  • 533
  • 3
  • 10
  • 20
1
vote
0 answers

Symfony/process start method not working

I want to process my script in background on Laravel. My code: File::findOrFail($id, ['id']); try { $process = new Process('php ../artisan api:get-products ' . $id); $process->start(); } catch (\Exception $e) { $log = new…
J.Menshov
  • 83
  • 6
1
vote
0 answers

Symfony console PTY

I am trying to get an interactive program to run in PHP, now this works fine in TTY, only I can only have some control of the STDIN / STDOUT through PTY. Only when I try this it has some weird side effects, like the code below when i type something…
Chris
  • 8,168
  • 8
  • 36
  • 51
1
vote
1 answer

Sending back the output of a daemon through a socket

I'm creating a Twitter client, and I need to handle the tweets coming from each streaming processes (started with Symfony's Process component). I have a websocket server running in the background which works perfectly. My problem is that I don't…
Isty001
  • 144
  • 1
  • 11
1
vote
2 answers

Symfony execution of long running script

I am using Symfony2 and I want to run a long script written in C++ (for example 60 minutes). Now I do it via shell_exec(): $pid = shell_exec('nohup my/program/written/in/c++.out some arguments > /dev/null 2>/dev/null & echo $!'); If I keep…
H.W.
  • 343
  • 1
  • 5
  • 21
1
vote
1 answer

PHP proc_open & exec timeout but cli works fine

I'm currently using the Symfony Process component, which relies on the proc_open function of PHP. I need to launch a command to wkhtmltopdf, which has this form : /usr/local/bin/wkhtmltopdf --window-status "___RENDER_PDF___" --orientation…
Talus
  • 754
  • 7
  • 18
1
vote
0 answers

Managing multiple PHP worker child processes using Symfony2 Process

I want to use Symfony2 Process to create a process with multiple worker child process. Basically I have a skeleton executable PHP script like below #!/usr/bin/env php
Petra Barus
  • 3,815
  • 8
  • 48
  • 87
1
vote
3 answers

Symfony Process run as who?

When we using Symfony\Component\Process\Process, the command run as who? I tried the command whoami through Process, but it return void??? $return = exec('whoami'); echo $return."\n"; // return [myname] $process = new Process('whoami'); // The…
GusDeCooL
  • 5,639
  • 17
  • 68
  • 102
1
vote
1 answer

Symfony2 Process component - unable to create pipe and launch a new process

I'm using the Symfony2 Process component to manually manage a pool of processes. In the example below I restart 2 simple processes every 2 seconds and monitor what happens. The application breaks after restarting these processes a few hundred…
ukliviu
  • 3,136
  • 1
  • 24
  • 30
1
vote
1 answer

How do I run a php function in a subprocess in Symfony2?

I want to run some functions parallel in the background. Is there a nice way to do this in Symfony2 or even with php? Or is there only the Symfony\Component\Process\Process? Can I use this Process with a function? I need the actual Context (logged…
zonky
  • 1,058
  • 9
  • 11
0
votes
1 answer

Using ProcessBuilder in a Silex Project

I am wanting to use the Symfony\Component\Process\ProcessBuilder class and can see that it is included as part of the Silex codebase within the vendors folder. I am using the Silex phar file and assume that because I can readily instantiate other…
danspam
  • 195
  • 1
  • 6