Untitled

mail@pastecode.io avatar
unknown
python
5 months ago
1.9 kB
3
Indexable
Esse é o trecho de código de dentro da classe que foi necessário modificar. Antes, estava usando o parâmetro que deixei comentado com "#".
A modificação foi simplesmente substituir pela linha abaixo dela: "creationflags=subprocess.CREATE_NO_WINDOW".


            self.process = subprocess.Popen(
                cmd,
                env=self.env,
                close_fds=close_file_descriptors,
                stdout=self.log_output,
                stderr=self.log_output,
                stdin=PIPE,
                # creationflags=self.creation_flags,
                creationflags=subprocess.CREATE_NO_WINDOW,
                startupinfo=start_info,
                **self.popen_kw,

__________________________________________________________________________________________________________________________________

    def _start_process(self, path: str) -> None:
        """Creates a subprocess by executing the command provided.

        :param cmd: full command to execute
        """
        cmd = [path]
        cmd.extend(self.command_line_args())
        close_file_descriptors = self.popen_kw.pop("close_fds", system() != "Windows")
        try:
            start_info = None
            if system() == "Windows":
                start_info = subprocess.STARTUPINFO()
                start_info.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
                start_info.wShowWindow = subprocess.SW_HIDE

            self.process = subprocess.Popen(
                cmd,
                env=self.env,
                close_fds=close_file_descriptors,
                stdout=self.log_output,
                stderr=self.log_output,
                stdin=PIPE,
                # creationflags=self.creation_flags,
                creationflags=subprocess.CREATE_NO_WINDOW,
                startupinfo=start_info,
                **self.popen_kw,
            )


Leave a Comment