Skip to content

Commit 1b1b4e8

Browse files
committed
Use common readFile/spawn deps
1 parent 6a7a6c1 commit 1b1b4e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/commands/manifest/scala.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import child_process from 'node:child_process'
21
import fs from 'node:fs'
32
import path from 'node:path'
43
import util from 'node:util'
54

65
import meow from 'meow'
76

7+
import spawn from '@npmcli/promise-spawn'
88
import { Spinner } from '@socketsecurity/registry/lib/spinner'
99

10+
import { safeReadFile } from '../../utils/fs'
1011
import { getFlagListOutput } from '../../utils/output-formatting.ts'
1112

1213
import type { CliSubcommand } from '../../utils/meow-with-subcommands'
@@ -15,7 +16,6 @@ type ListDescription =
1516
| string
1617
| { description: string; type?: string; default?: string }
1718

18-
const execp = util.promisify(child_process.exec)
1919
const renamep = util.promisify(fs.rename)
2020

2121
const description =
@@ -177,7 +177,7 @@ async function startConversion(
177177
// We must now run sbt, pick the generated xml from the /target folder (the stdout should tell you the location upon success) and store it somewhere else.
178178
// TODO: Not sure what this somewhere else might be tbh.
179179

180-
const output = await execp(bin + ` makePom ${sbtOpts.join(' ')}`, {
180+
const output = await spawn(bin, ['makePom'].concat(sbtOpts), {
181181
cwd: target || '.'
182182
})
183183
spinner.success()
@@ -205,7 +205,7 @@ async function startConversion(
205205
// Move the pom file to ...? initial cwd? loc will be an absolute path, or dump to stdout
206206
if (out === '-') {
207207
spinner.start('Result:\n```').success()
208-
console.log(fs.readFileSync(loc, 'utf8'))
208+
console.log(await safeReadFile(loc, 'utf8'))
209209
console.log('```')
210210
spinner.start().success(`OK`)
211211
} else {

0 commit comments

Comments
 (0)