-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi, is there a way to use this with child_process.spawn?
I've tried passing stdin and stdout to .monitor(), I've tried using this library: https://github.com/stream-utils/duplex-child-process but I'm not having any luck.
My code looks like this:
import dps from 'duplex-child-process'
export function addKey( password ) {
return new Promise( (resolve, reject) => {
const parser = new Expect()
parser
.conversation(/ssh-add/)
.sync()
.expect(/Enter passphrase/)
.send(`${password}\n`)
.branch(/Identity added/)
.handler(()=> { console.log('added'); resolve() })
.branch(/Bad passphrase/)
.handler(()=> { console.log('bad'); reject() })
.end()
parser.write("ssh-add\n")
parser.monitor(dps.spawn('ssh-add', [ '-K', '~/.ssh/id_rsa' ]))
})
}Grenadingue
Metadata
Metadata
Assignees
Labels
No labels