• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ShellCmdResult
2
3The **ShellCmdResult** module provides the shell command execution result.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9**System capability**: SystemCapability.Ability.AbilityRuntime.Core
10
11| Name     | Type  | Readable| Writable| Description                                                        |
12| --------- | ------ | ---- | ---- | ------------------------------------------------------------ |
13| stdResult | string | Yes  | Yes  | Standard output content.|
14| exitCode  | number | Yes  | Yes  | Result code.|
15
16## Usage
17
18The result is obtained by calling [executeShellCommand](js-apis-inner-application-abilityDelegator.md#executeshellcommand) in **abilityDelegator**.
19
20**Example**
21```ts
22import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
23let abilityDelegator;
24let cmd = 'cmd';
25
26abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
27abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => {
28    console.info('executeShellCommand callback, failed: ', err);
29    console.info('executeShellCommand callback, success: ', data);
30});
31```
32