mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
- Bump SDK version to 0.4.0-beta.54 - Add `server.device-info` RPC endpoint and `s9pk select` CLI command - Extract `HardwareRequirements::is_compatible()` method, reuse in registry filtering - Add `AbortedError` class with `muteUnhandled` flag, replace generic abort errors - Handle unhandled promise rejections in container-runtime with mute support - Improve `InputSpec.filter()` with `keepByDefault` param and boolean filter values - Accept readonly tuples in `CommandType` and `splitCommand` - Remove `sync_host` calls from host API handlers (binding/address changes) - Filter mDNS hostnames by secure gateway availability - Derive mDNS enabled state from LAN IPs in web UI - Add "Open UI" action to address table, disable mDNS toggle - Hide debug details in service error component - Update rpc-toolkit docs for no-params handlers
23 lines
705 B
TypeScript
23 lines
705 B
TypeScript
import { AllowReadonly } from '../types'
|
|
|
|
/**
|
|
* Normalizes a command into an argv-style string array.
|
|
* If given a string, wraps it as `["sh", "-c", command]`.
|
|
* If given a tuple, returns it as-is.
|
|
*
|
|
* @param command - A shell command string or a pre-split argv tuple
|
|
* @returns An argv-style string array suitable for process execution
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* splitCommand("echo hello") // ["sh", "-c", "echo hello"]
|
|
* splitCommand(["node", "index.js"]) // ["node", "index.js"]
|
|
* ```
|
|
*/
|
|
export const splitCommand = (
|
|
command: string | AllowReadonly<[string, ...string[]]>,
|
|
): string[] => {
|
|
if (Array.isArray(command)) return command
|
|
return ['sh', '-c', command as string]
|
|
}
|