You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The refactor in 4b55e79 that moved ExecuteCommand from Dependencies to
Core/Components replaced GetCommandsToExecute() (split on &&, loop) with
GetCommandToExecute() (single command), completely removing && splitting.
This broke all profiles using chained commands (PERF-REDIS, PERF-MEMCACHED,
GET-STARTED-REDIS, PERF-NETWORK).
Changes:
- Restore && split-and-loop in ExecuteAsync for UseShell=false (default)
- UseShell=true path preserved: wraps in bash -c / cmd /C as single command
- Quote-aware SplitCommands method skips && inside single/double quotes
- Restore sudo auto-propagation for chained commands
- Add tests for chaining, sudo propagation, profile-matching commands,
relative paths with working directory, and Windows chaining
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
// There appears to be an unfortunate implementation choice in .NET causing a Win32Exception similar to the following when
140
-
// referencing a binary and setting the working directory.
141
-
//
142
-
// System.ComponentModel.Win32Exception:
143
-
// 'An error occurred trying to start process 'Coreinfo64.exe' with working directory 'S:\microsoft\virtualclient\out\bin\Debug\AnyCPU\VirtualClient.Main\net9.0\packages\system_tools\win-x64'.
144
-
// The system cannot find the file specified.
145
-
//
146
-
// The .NET Process class does not reference the 'WorkingDirectory' when looking for the 'FileName' when UseShellExecute = false. The workaround
147
-
// for this is to add the working directory to the PATH environment variable.
// There appears to be an unfortunate implementation choice in .NET causing a Win32Exception similar to the following when
142
+
// referencing a binary and setting the working directory.
143
+
//
144
+
// System.ComponentModel.Win32Exception:
145
+
// 'An error occurred trying to start process 'Coreinfo64.exe' with working directory 'S:\microsoft\virtualclient\out\bin\Debug\AnyCPU\VirtualClient.Main\net9.0\packages\system_tools\win-x64'.
146
+
// The system cannot find the file specified.
147
+
//
148
+
// The .NET Process class does not reference the 'WorkingDirectory' when looking for the 'FileName' when UseShellExecute = false. The workaround
149
+
// for this is to add the working directory to the PATH environment variable.
// There are a few command chaining scenarios we need to handle:
231
-
// 1) Chaining that is not related to a shell (e.g. "execute_one.sh && execute_two.sh"). For these scenarios, we will execute these
232
-
// each in sequential order as separate processes.
233
-
//
234
-
// 2) For cases where a shell is referenced, we will execute the entire command as a single process and let the shell handle the chaining (e.g. "bash -c 'execute_one.sh && execute_two.sh'").
235
-
236
-
stringtargetCommand=this.Command;
237
233
if(this.UseShell)
238
234
{
239
-
// Using a shell (e.g. bash, cmd) allows support for command chaining and other shell features. The user can define the shell directly.
240
-
// The 'UseShell' parameter is a flag for convenience and to support cross-platform scenarios in a single profile component definition.
235
+
// When using a shell (e.g. bash, cmd), the entire command is passed to the shell as a single
236
+
// process and the shell handles any chaining (e.g. &&).
0 commit comments