Receiving unknown flag from C# invoke powershell

54 views Asked by At

in C# app i invoke powershell in a proccess to run this docker command: docker-compose --progress tty ... i get:

unknown flag: --progress tty

Build command:


string appArgument = "docker-compose --progress tty -p wsdd-projects -f C:\docker-structure\init.yml up -d --build"

string policy = "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force";

arguments = $"-Command \"{policy} ; {appArgument}\"";

I am trying force a tty enviroment for docker command but it won't work.

However it works on a powershell terminal windows in same computer, related post

It seems that I need to call not only the PowerShell process, but also make a window open hidden from the user to execute the command, apparently depending on whether it is a process or a Windows window it will have a specific behavior.

this is my build:

ProcessStartInfo processBuilder = new("powershell")
{
    Arguments = arguments,
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    Verb = "runas",
    CreateNoWindow = true,
    StandardOutputEncoding = Encoding.UTF8,
    StandardErrorEncoding = Encoding.UTF8
};

Update:

Check versions and support from 2 enviroment caller:

enter image description here

Custom:

enter image description here

Update 2:

ok, ha ve detected that hiden termina is missing something that is requiered to handle tty mode... and i am get this message:

powershell -Command "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force ; docker-compose --progress tty -p wsdd-projects -f C:\Docker-Structure\init.yml up -d --build"
Controlador no válido.

and translation is:

Controlador no válido = Invalid driver.

I have reached this point... no idea what this message is about...

0

There are 0 answers