Skip to content

Commit b65ba72

Browse files
mafintoshandrewosh
authored andcommitted
harden fuse setup
1 parent 95c1627 commit b65ba72

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/commands/fuse-setup.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const p = require('path')
22
const fs = require('fs').promises
3-
const { exec } = require('child_process')
3+
const { spawn } = require('child_process')
44
const { Command, flags } = require('@oclif/command')
55

66
const { HyperdriveClient } = require('hyperdrive-daemon-client')
@@ -69,8 +69,12 @@ class SetupCommand extends Command {
6969
console.log('Note: FUSE is already configured.')
7070
} else {
7171
return new Promise((resolve, reject) => {
72-
exec(`sudo ${process.execPath} ${p.join(__dirname, '../../scripts/configure.js')}`, err => {
73-
if (err) return reject(err)
72+
const child = spawn('sudo', [process.execPath, p.join(__dirname, '../../scripts/configure.js')], {
73+
stdio: 'inherit'
74+
})
75+
child.on('error', reject)
76+
child.on('exit', code => {
77+
if (code) return reject(new Error(code))
7478
return resolve()
7579
})
7680
})

0 commit comments

Comments
 (0)