{"record":{"id":"c14644211015beb6","repo":"symfony/process","slug":"enabling-output-while-the-process-is-running-is-not-possible","errorCode":null,"errorMessage":"Enabling output while the process is running is not possible.","messagePattern":"Enabling output while the process is running is not possible\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"Process.php","lineNumber":612,"sourceCode":"            throw new LogicException('Output cannot be disabled while an idle timeout is set.');\n        }\n\n        $this->outputDisabled = true;\n\n        return $this;\n    }\n\n    /**\n     * Enables fetching output and error output from the underlying process.\n     *\n     * @return $this\n     *\n     * @throws RuntimeException In case the process is already running\n     */\n    public function enableOutput(): static\n    {\n        if ($this->isRunning()) {\n            throw new RuntimeException('Enabling output while the process is running is not possible.');\n        }\n\n        $this->outputDisabled = false;\n\n        return $this;\n    }\n\n    /**\n     * Returns true in case the output is disabled, false otherwise.\n     */\n    public function isOutputDisabled(): bool\n    {\n        return $this->outputDisabled;\n    }\n\n    /**\n     * Returns the current output of the process (STDOUT).\n     *","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/Process.php#L594-L630","documentation":"enableOutput() throws this RuntimeException when the process is currently running. Like disableOutput(), toggling output capture is only allowed while the process is not started, because stream wiring is fixed at start time.","triggerScenarios":"Calling Process::enableOutput() after start()/run() on a still-running process.","commonSituations":"Trying to re-enable output after earlier disabling it, but doing so once the process is already running; generic configuration code that toggles output based on flags executed late in the lifecycle.","solutions":["Call enableOutput() before start()/run().","Wait for the process to finish (wait()) or stop it before enabling output.","Recreate and restart the process with output enabled."],"exampleFix":"// before\n$process->start();\n$process->enableOutput(); // RuntimeException\n\n// after\n$process->enableOutput();\n$process->start();","handlingStrategy":"validation","validationCode":"if (!$process->isRunning()) {\n    $process->enableOutput();\n}","typeGuard":null,"tryCatchPattern":"try {\n    $process->enableOutput();\n} catch (\\RuntimeException $e) {\n    // process running; wait() or stop() before toggling output\n}","preventionTips":["Toggle output only in pre-start configuration code.","Centralize Process construction so all setters run before start() unconditionally."],"tags":["process","symfony","runtime-exception","invalid-state-transition"],"backgroundTag":"invalid-state-transition","analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}