I'm attempting to use C# to wrapper a linux executable that needs some hand holding of error and conditions. I am doing this inside a docker container and calling my C# app as the ENTRYPOINT
.
My C# application is properly starting up on container start and goes to start the sub-process but the sub-process errors out every single time it boots with the following.
panic: runtime error: invalid memory address or nil pointer dereference
If i remove my C# wrapper service and directly call the sub-process from ./entrypoint.sh
it boots up just fine.
I've been up/down and all over the place but i can't find anything about process.start
that could be creating a different start environment than a standard shell start.
I've tried directly executing the process, executing the process as a /bin/sh -c "myproc"
, and /bin/sh /app/entrypoint.sh
. No matter what happens, if it is started by process.Start()
it will crash, if its started via the shell it will be fine.
Here is my process start code.
_process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "/bin/sh",
Arguments = "/app/entrypoint.sh",
WorkingDirectory = "/app",
CreateNoWindow = true,
RedirectStandardError = false,
RedirectStandardOutput = false,
},
EnableRaisingEvents = true
};
My entrypoint.sh
is pretty simple.
#!/bin/sh
#whoami # returns root
#ps aux # looks fine
exec myproc-server
Does process.Start()
spawn the process in a method that would cause it to not be a full shell?
Turns out, i had to specify the following attributes.
Once i redirected the output and error it started working.