TerminalShell (macOS): detect full exe path

This commit is contained in:
李通洲
2024-01-19 10:50:02 +08:00
parent 06af39835a
commit 7d78d92a92
4 changed files with 25 additions and 13 deletions
+6 -3
View File
@@ -38,6 +38,7 @@ void ffPrintShell(FFShellOptions* options)
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version},
{FF_FORMAT_ARG_TYPE_UINT, &result->pid},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath},
});
}
}
@@ -90,6 +91,7 @@ void ffGenerateShellJsonResult(FF_MAYBE_UNUSED FFShellOptions* options, yyjson_m
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
yyjson_mut_obj_add_strbuf(doc, obj, "exe", &result->exe);
yyjson_mut_obj_add_strcpy(doc, obj, "exeName", result->exeName);
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &result->exePath);
yyjson_mut_obj_add_uint(doc, obj, "pid", result->pid);
yyjson_mut_obj_add_uint(doc, obj, "ppid", result->ppid);
yyjson_mut_obj_add_strbuf(doc, obj, "processName", &result->processName);
@@ -101,11 +103,12 @@ void ffPrintShellHelpFormat(void)
{
ffPrintModuleFormatHelp(FF_SHELL_MODULE_NAME, "{3} {4}", FF_SHELL_NUM_FORMAT_ARGS, (const char* []) {
"Shell process name",
"Shell path with exe name",
"Shell exe name",
"The first argument of the command line when running the shell",
"Shell base name of arg0",
"Shell version",
"Shell pid",
"Shell pretty name"
"Shell pretty name",
"Shell full exe path",
});
}
+7 -4
View File
@@ -6,7 +6,7 @@
#include <string.h>
#define FF_TERMINAL_NUM_FORMAT_ARGS 6
#define FF_TERMINAL_NUM_FORMAT_ARGS 7
void ffPrintTerminal(FFTerminalOptions* options)
{
@@ -36,6 +36,7 @@ void ffPrintTerminal(FFTerminalOptions* options)
{FF_FORMAT_ARG_TYPE_UINT, &result->pid},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath},
});
}
}
@@ -89,6 +90,7 @@ void ffGenerateTerminalJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yy
yyjson_mut_obj_add_strbuf(doc, obj, "processName", &result->processName);
yyjson_mut_obj_add_strbuf(doc, obj, "exe", &result->exe);
yyjson_mut_obj_add_strcpy(doc, obj, "exeName", result->exeName);
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &result->exePath);
yyjson_mut_obj_add_uint(doc, obj, "pid", result->pid);
yyjson_mut_obj_add_uint(doc, obj, "ppid", result->ppid);
yyjson_mut_obj_add_strbuf(doc, obj, "prettyName", &result->prettyName);
@@ -99,11 +101,12 @@ void ffPrintTerminalHelpFormat(void)
{
ffPrintModuleFormatHelp(FF_TERMINAL_MODULE_NAME, "{5} {6}", FF_TERMINAL_NUM_FORMAT_ARGS, (const char* []) {
"Terminal process name",
"Terminal path with exe name",
"Terminal exe name",
"The first argument of the command line when running the terminal",
"Terminal base name of arg0",
"Terminal pid",
"Terminal pretty name",
"Terminal version"
"Terminal version",
"Terminal full exe path",
});
}