}
err = __posix_spawn (&((_IO_proc_file *) fp)->pid, _PATH_BSHELL, fa, 0,
- (char *const[]){ (char*) "sh", (char*) "-c",
+ (char *const[]){ (char*) "sh", (char*) "-c", (char*) "--",
(char *) command, NULL }, __environ);
if (err != 0)
return err;
TEST_COMPARE_STRING (result.out.buffer, "...\n");
}
+ {
+ struct support_capture_subprocess result;
+ const char *cmd = "-echo";
+ result = support_capture_subprocess (call_system,
+ &(struct args) { cmd, 127 });
+ support_capture_subprocess_check (&result, "system", 0, sc_allow_stderr |
+ sc_allow_stdout);
+ char *returnerr = xasprintf ("%s: execing -echo failed: "
+ "No such file or directory",
+ basename(_PATH_BSHELL));
+ TEST_COMPARE_STRING (result.err.buffer, returnerr);
+ free (returnerr);
+ }
+
{
struct support_capture_subprocess result;
result = support_capture_subprocess (call_system,
dprintf (stderr, " argv[%d] is `%s'\n", i, argv[i]);
if (strcmp (argv[1], "-c") == 0)
- run_command_string (argv[2], argv+3);
+ {
+ if (strcmp (argv[2], "--") == 0)
+ run_command_string (argv[3], argv+4);
+ else
+ run_command_string (argv[2], argv+3);
+ }
else
run_script (argv[1], argv+2);
ret = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr,
(char *const[]){ (char *) SHELL_NAME,
(char *) "-c",
+ (char *) "--",
(char *) line, NULL },
__environ);
__posix_spawnattr_destroy (&spawn_attr);