FORMAT_MESSAGE_IGNORE_INSERTS,
0, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf, 0, 0);
- cb_println(CB_LogLevel_Error, "Child process creation failed with error %u: %s",
- error, lpMsgBuf);
+ cb_println(CB_LogLevel_Error, "Child process `%s` creation failed with error %u: %s",
+ cmd->values[0], error, lpMsgBuf);
exit(-1);
}
#else
res.handle = fork();
if (res.handle < 0) {
- cb_println(CB_LogLevel_Error, "Child process creation failed with error %d: %s\n",
- errno, strerror(errno));
+ cb_println(CB_LogLevel_Error, "Child process `%s` creation failed with error %d: %s\n",
+ cmd->values[0], errno, strerror(errno));
exit(-1);
} else if (!res.handle) {
if (args.stdout) { dup2(args.stdout, STDOUT_FILENO); }
cb_cmd_append_dyn(&_cmd, cmd->values, cmd->count);
cb_cmd_push(&_cmd, 0);
if (execvp(_cmd.values[0], _cmd.values) < 0) {
- cb_println(CB_LogLevel_Error, "Child process creation failed with error %d: %s\n",
- errno, strerror(errno));
+ cb_println(CB_LogLevel_Error, "Child process `%s` creation failed with error %d: %s\n",
+ cmd->values[0], errno, strerror(errno));
exit(-1);
}
// NOTE(lb): unreachable, execvp only returns on error.
CB_Cmd cmd = {};
CB_ProcessList procs = {};
+#if OS_WINDOWS
+ cb_cmd_append(&cmd, "cmd.exe", "/C", "dir");
+ cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
+ cb_cmd_append(&cmd, "cmd.exe", "/C", "dir", "C:\\");
+ cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
+#else
cb_cmd_append(&cmd, "ls", "-lah", ".");
cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
cb_cmd_append(&cmd, "ls", "-lah", "/");
cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
cb_cmd_append(&cmd, "pwd");
cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
+#endif
cb_proclist_wait(&procs);
}