-
-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
Issue
StreamProcessExecutor fails if SudoMechanism Password is set.
Exception
System.ComponentModel.Win32Exception
An error occurred trying to start process 'echo ******** | sudo -S /usr/bin/docker' with working directory '/mnt/data/dev/fluentdocker.demo/bin/Debug/net6.0'. No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Ductus.FluentDocker.Executors.ConsoleStream`1..ctor(ProcessStartInfo startInfo, IStreamMapper`1 mapper, CancellationToken token)
at Ductus.FluentDocker.Executors.StreamProcessExecutor`2.Execute(CancellationToken token)
Potential Cause
The ConsoleStream's constructor on line 60 is trying to start a process with a FileName of "echo somepassword | sudo -S /usr/bin/docker... " and no arguments.
Source: https://github.com/mariotoffia/FluentDocker/blob/master/Ductus.FluentDocker/Executors/ConsoleStream.cs#L60
The StreamProcessorExecutor does not seem to take the SudoMechanism Password into account, unlike the ProcessExecutor.
The StreamProcessExecutor's constructor:
public StreamProcessExecutor(string command, string arguments, string workingdir = null)
{
_command = command;
_arguments = arguments;
_workingdir = workingdir;
}The ProcessExecutor does not seem to have this issue.
The ProcessExecutor's constructor:
public ProcessExecutor(string command, string arguments, string workingdir = null)
{
_workingdir = workingdir;
if (command.StartsWith("echo") || command.StartsWith("sudo"))
{
_command = CommandExtensions.DefaultShell;
_arguments = $"-c \"{command} {arguments}\"";
return;
}
_command = command;
_arguments = arguments;
}