harmony(鸿蒙)ShellCmdResult

  • 2022-08-09
  • 浏览 (683)

ShellCmdResult

The ShellCmdResult module provides the shell command execution result.

NOTE

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.

Usage

The result is obtained by calling executeShellCommand in abilityDelegator.

import AbilityDelegatorRegistry from "@ohos.application.abilityDelegatorRegistry";
let abilityDelegator;
let cmd = "cmd";

abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => {
    console.info("executeShellCommand callback, failed: ", err);
    console.info("executeShellCommand callback, success: ", data);
});

ShellCmdResult

Describes the shell command execution result.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Type Readable Writable Description
stdResult string Yes Yes Standard output content.
exitCode number Yes Yes Result code.

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)APIs

harmony(鸿蒙)API Reference Document Description

harmony(鸿蒙)BundleStatusCallback

harmony(鸿蒙)innerBundleManager(deprecated)

harmony(鸿蒙)distributedBundle

harmony(鸿蒙)Bundle

harmony(鸿蒙)Context

harmony(鸿蒙)DataUriUtils

harmony(鸿蒙)EnterpriseAdminExtensionAbility

harmony(鸿蒙)Work Scheduler Callbacks

0  赞