osmates vm exec
Run a program in a machine's guest.
osmates vm exec [<options>] <machine> [<arguments> ...]The guest agent runs the program with its arguments as given, and no shell interprets them. Put the program after --, so its options stay its own. Run a shell for pipes and variables.
The output streams here as it comes, and Control-C interrupts the program. A machine that is starting is waited for.
The command exits with the program's status, 124 when it ran out of time, 125 when the command or the guest failed, or 128 plus the signal that ended it. When the guest agent stays silent for 10 minutes, the program is left running and the command names its PID.
Programs, jobs and exit statuses: https://osmates.com/docs/cli
Examples
osmates vm exec dev -- ls -l /etc
osmates vm exec dev -- sh -c 'ls | wc -l'
osmates vm exec dev --detach -- make buildArguments
<machine>RequiredThe machine's identifier or name.
--user <user>The guest account to run as. Default: root, or LocalSystem in Windows.
With --desktop, the account expected at the screen. Windows takes an account only with --desktop.
--workdir <workdir>The working directory. Default: the account's home, C:\ in Windows, or the user's profile with --desktop.
--env <name=value>RepeatableAdd a variable to the program's environment.
--timeout <timeout>Seconds the program runs before it's killed. Default: no limit.
--desktopRun as the user signed in at the screen, on their desktop.
--arch <arch>Which code of a program built for several architectures runs.
One of
arm64,x64.-i, --stdinPass this command's standard input to the program.
--detachRun it as a job and print the job's id.
Follow the job with
osmates job.--jsonPrint machine-readable JSON.
<arguments>RepeatableThe program and its arguments, after --.
JSON output
With --json, it prints an object with these fields.
JSON Schema: /schemas/0/cli/vm/exec.json
exitCodeintegersignalintegerstandardErrorstring (base64)RequiredstandardErrorTruncatedbooleanRequiredstandardOutputstring (base64)RequiredstandardOutputTruncatedbooleanRequiredtimedOutbooleanRequired
With --detach
With --json and --detach, it prints an object with these fields.
JSON Schema: /schemas/0/cli/vm/exec.detach.json
createdAtstring (date-time)RequiredcreationStepsarray of strings or objectsEach item is one of
preparing,verifying,unpacking,waitingForMacOS,waitingForMachine,installingWindows,settingUpTemplate,startingMacOS,installingGuestAgent,copyingXcode,settingUpXcode,downloadingSimulator,readingMachine,finishing,stopping, or an object that holds one key:downloading,copyingInstallationFile,installingMacOS,installingDesktop,installingLinuxorconvertingDisk.creationSteps[].downloadingobjectcreationSteps[].copyingInstallationFileobjectcreationSteps[].installingMacOSobjectcreationSteps[].installingDesktopobjectcreationSteps[].installingLinuxobjectcreationSteps[].convertingDiskobjectfailureobjectfailure.actionsarray of objectsRequiredfailure.codestringfailure.kindstringRequiredOne of
failed,temporary,wrongInput.failure.messagestringRequiredidstringRequiredkindstringRequiredOne of
create,resume,clone,delete,start,suspend,snapshot,revert,exec,run,transfer,clipboard,compact,grow-disk,workspace-push,workspace-diff,export-disk,move,update-macos,update-firmware,move-image-cache,template-push,template-pull.machinestringRequiredoutputobject with integer valuesRequiredoutput.stdoutintegerAt least 0.
output.stderrintegerAt least 0.
progressobjectprogress.fractionnumberprogress.messagestringRequiredprogress.stepstring or objectOne of
preparing,verifying,unpacking,waitingForMacOS,waitingForMachine,installingWindows,settingUpTemplate,startingMacOS,installingGuestAgent,copyingXcode,settingUpXcode,downloadingSimulator,readingMachine,finishing,stopping, or an object that holds one key:downloading,copyingInstallationFile,installingMacOS,installingDesktop,installingLinuxorconvertingDisk.resultobjectHolds one key:
machine,deleted,started,suspended,snapshot,reverted,process,run,transfer,clipboard,compaction,diskGrowth,workspace,workspaceDiff,exported,moved,macOSUpdate,firmwareUpdate,imageCacheMoved,pushedorpulled.result.machineobjectresult.deletedobjectresult.startedobjectresult.suspendedobjectresult.snapshotobjectresult.revertedobjectresult.processobjectresult.runobjectresult.transferobjectresult.clipboardobjectresult.compactionobjectresult.diskGrowthobjectresult.workspaceobjectresult.workspaceDiffobjectresult.exportedobjectresult.movedobjectresult.macOSUpdateobjectresult.firmwareUpdateobjectresult.imageCacheMovedobjectresult.pushedobjectresult.pulledobjectstatestringRequiredOne of
running,succeeded,failed,cancelled.stepsarray of objectssteps[].endedstring (date-time)steps[].problemstringsteps[].startedstring (date-time)Requiredsteps[].stepstringRequiredOne of
clone,start,signIn,workspace,copyIn,program,copyOut,diff,delete.summarystringRequiredupdatedAtstring (date-time)Required
Fields nested deeper are in the schema.
Exit statuses
Its exit status is one of these.
| Status | Meaning |
|---|---|
| 0 | The command did what it was asked. |
| 1 | The command failed; with --json, standard error's last line is the error object. |
| 64 | The command line is wrong, as ArgumentParser found before the command ran. |
| 65 | What was given is wrong, found while the command ran; the same command fails until it changes. |
| 75 | The same command can work later with nothing changed, as while an update finishes. |
| 130 | Control-C cancelled what the command started. |
| 0 to 255 | The program's own status; one outside 0 to 255, as a Windows program's can be, exits 1, and vm exec --json gives it whole. |
| 124 | The program ran out of time. |
| 125 | The command failed, apart from the program it runs. |
| 129 to 192 | 128 plus the signal that ended the program, as the guest numbers it. |