mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 01:17:51 +08:00
feat(px4): support Windows daemon and shell runtime
Make PX4 startup, daemon command handling, shell I/O, shutdown, logging, getopt, and instance state work across POSIX and native Windows runtime boundaries. Keep command-client behavior explicit by routing shell output through shared logger paths and preserving socket protocol return markers during shutdown.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/exit.h>
|
||||
#include <uORB/uORB.h>
|
||||
|
||||
#include "apps.h"
|
||||
@@ -43,9 +44,21 @@ void list_builtins(apps_map_type &apps)
|
||||
|
||||
int shutdown_main(int argc, char *argv[])
|
||||
{
|
||||
// Reject any leftover positional arguments (e.g. "status", "start", "stop").
|
||||
// shutdown takes no flags or subcommands -- it always tears the daemon
|
||||
// down -- so silently ignoring extra args would terminate the daemon when
|
||||
// the user almost certainly meant a different module (e.g.
|
||||
// "<module> status"). Print usage and exit non-zero instead.
|
||||
if (argc > 1) {
|
||||
PX4_ERR("unrecognized argument: %s", argv[1]);
|
||||
printf("Usage:\n shutdown\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Exiting NOW.\n");
|
||||
uorb_shutdown();
|
||||
system_exit(0);
|
||||
px4_platform_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_tasks_main(int argc, char *argv[])
|
||||
|
||||
Reference in New Issue
Block a user