• 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## Modules to Import
10
11```ts
12import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
13```
14
15**System capability**: SystemCapability.Ability.AbilityRuntime.Core
16
17| Name     | Type  | Readable| Writable| Description                                                        |
18| --------- | ------ | ---- | ---- | ------------------------------------------------------------ |
19| stdResult | string | Yes  | Yes  | Standard output content.|
20| exitCode  | number | Yes  | Yes  | Result code.|
21
22## Usage
23
24The result is obtained by calling [executeShellCommand](js-apis-inner-application-abilityDelegator.md#executeshellcommand) in **abilityDelegator**.
25
26**Example**
27```ts
28let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator;
29let cmd = 'cmd';
30
31abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
32abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => {
33    console.info('executeShellCommand callback, failed: ', err);
34    console.info('executeShellCommand callback, success: ', data);
35});
36```
37