Skip to content

Commit

Permalink
fix: windows stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 28, 2018
1 parent bca1771 commit 8fc27ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/commands/plugins/install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Command} from '@dxcli/command'
import cli from 'cli-ux'

import Plugins from '../../plugins'

Expand Down Expand Up @@ -32,7 +33,9 @@ export default class PluginsInstall extends Command {
if (scoped) plugin = plugin.slice(1)
let [name, tag = 'latest'] = plugin.split('@')
if (scoped) name = `@${name}`
cli.action.start(`Installing plugin ${plugin}@${tag}`)
await this.plugins.install(name, tag)
cli.action.stop()
}
}
}
3 changes: 3 additions & 0 deletions src/commands/plugins/uninstall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Command} from '@dxcli/command'
import cli from 'cli-ux'

import Plugins from '../../plugins'

Expand Down Expand Up @@ -28,7 +29,9 @@ export default class PluginsUninstall extends Command {
async run() {
this.plugins = new Plugins(this.config)
for (let plugin of this.argv) {
cli.action.start(`Uninstalling ${plugin}`)
await this.plugins.uninstall(plugin)
cli.action.stop()
}
}
}
10 changes: 6 additions & 4 deletions src/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default class Yarn {
return new Promise((resolve, reject) => {
const {fork} = require('child_process')
let forked = fork(modulePath, args, options)
forked.stdout.on('data', (d: any) => process.stdout.write(d))
forked.stderr.on('data', (d: any) => process.stderr.write(d))

forked.on('error', reject)
forked.on('exit', (code: number) => {
Expand All @@ -32,9 +34,9 @@ export default class Yarn {
})

// Fix windows bug with node-gyp hanging for input forever
if (this.config.windows) {
forked.stdin.write('\n')
}
// if (this.config.windows) {
// forked.stdin.write('\n')
// }
})
}

Expand All @@ -57,7 +59,7 @@ export default class Yarn {
const npmRunPath = require('npm-run-path')
let options = {
cwd: this.cwd,
stdio: [0, 1, 2, 'ipc'],
stdio: [0, null, null, 'ipc'],
env: npmRunPath.env({cwd: this.cwd, env: process.env}),
}

Expand Down

0 comments on commit 8fc27ef

Please sign in to comment.