util: Add general subprocess helper
This commit is contained in:
parent
e29ddb5baf
commit
31a18c6697
3 changed files with 8 additions and 4 deletions
|
@ -3,7 +3,7 @@ import * as path from 'path'
|
|||
import * as xml2js from 'xml2js'
|
||||
|
||||
import { serializeBlueprint } from '../build/soong'
|
||||
import { aapt2 } from '../util/aapt2'
|
||||
import { aapt2 } from '../util/process'
|
||||
import { exists, listFilesRecursive } from '../util/fs'
|
||||
import { XML_HEADER } from '../util/headers'
|
||||
import { parseLines } from '../util/parse'
|
||||
|
|
|
@ -2,7 +2,7 @@ import { promises as fs } from 'fs'
|
|||
import * as path from 'path'
|
||||
|
||||
import { parseSeappContexts } from '../sepolicy/seapp'
|
||||
import { aapt2 } from '../util/aapt2'
|
||||
import { aapt2 } from '../util/process'
|
||||
import { listFilesRecursive } from '../util/fs'
|
||||
import { BlobEntry } from './entry'
|
||||
|
||||
|
|
|
@ -3,8 +3,12 @@ import { exec as execCb } from 'child_process'
|
|||
|
||||
const exec = util.promisify(execCb)
|
||||
|
||||
export async function aapt2(path: string, ...args: Array<string>) {
|
||||
export async function run(command: string) {
|
||||
// TODO: stop using shell
|
||||
let { stdout, stderr } = await exec(`${path} ${args.join(' ')}`)
|
||||
let { stdout } = await exec(command)
|
||||
return stdout.trim()
|
||||
}
|
||||
|
||||
export async function aapt2(path: string, ...args: Array<string>) {
|
||||
return await run(`${path} ${args.join(' ')}`)
|
||||
}
|
Loading…
Reference in a new issue