Process.run failed when the same command work in the terminal

Hi, recently I face some problems with Process.run command.

Sometimes, some command just failed with process.run while when I typed it in a terminal it just work properly.

This an example. I took a screenshot as well to show you:

This is my code used to run xmlcatalog command under a linux system:

def runSystemCommand(arguments = Array(String).new, path = Ism.settings.installByChroot ? "/" : Ism.settings.rootPath, environment = Hash(String, String).new) : Process::Status
            environmentCommand = (environment.map { |key| key.join("=") }).join(" ")

            if Ism.settings.installByChroot
                chrootCommand = <<-CODE
                #!/bin/bash
                cd #{path} && #{environmentCommand} #{arguments.join(" ")}
                CODE

                process = runChrootTasks(chrootCommand)
            else
                process = Process.run(  arguments[0],
                                        args: arguments[1..arguments.size-1],
                                        output: Process::Redirect::Inherit,
                                        error: Process::Redirect::Inherit,
                                        shell: true,
                                        chdir: path,
                                        env: environment)
            end

            return process
        end

        def runXmlCatalogCommand(arguments : Array(String))
                    requestedCommands = ["xmlcatalog"]+arguments
        
                    process = runSystemCommand(requestedCommands)
        
                    if !process.success?
                        Ism.notifyOfRunSystemCommandError(requestedCommands)
                        Ism.exitProgram
                    end
                end

This process when this bug occured was call like that:

runXmlCatalogCommand([  "--noout",
                                "--add",
                                "\"rewriteSystem\"",
                                "\"https://cdn.docbook.org/release/xsl-nons/1.79.2\"",
                                "\"/usr/share/xml/docbook/xsl-stylesheets-nons-1.79.2\"",
                                "/etc/xml/catalog"])

You will see in the screenshot, I show the difference between the catalog.old (result with Process.run) and the other catalog file (successfully rewrite by a normal command without crystal)