We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
same as SBoudrias/Inquirer.js#518, spawn(hookName, args, {stdio: 'inherit'}) will finish, not wait for user input(by inquirer.js).
my code is:
// .githooks/pre-commit/hello.js #!/usr/bin/env node console.log('start select ...'); 'use strict'; var inquirer = require('inquirer'); var config = require('../../config/var-app'); var fs = require('fs'); var path = require('path'); inquirer .prompt([ { type: 'list', name: 'appid', message: 'What mini application do you want?', choices: config.APPS } ]) .then(answers => { var appId = answers.appid; var filePath = path.resolve(__dirname, '../../config/var-app.js'); console.log('appid: ' + appId); fs.readFile(filePath, 'utf8', function(err, data) { if (err) return console.log(err); var res = data.replace(/\$appid\s*=\s*\'[^']*\'/g, "$appid = '" + appId + "'"); fs.writeFile(filePath, res, 'utf8', function(err) { if (err) return console.log(err); console.log('select mini application finished!') }); }); });
entry code is:
git add -A && git commit -m "test" // this will skip user input; but use 'node ./.githooks/pre-commit/hello.js', everything is ok.
The text was updated successfully, but these errors were encountered:
same as SBoudrias/Inquirer.js#518, spawn(hookName, args, {stdio: 'inherit'}) will finish, not wait for user input(by inquirer.js). my code is: // .githooks/pre-commit/hello.js #!/usr/bin/env node console.log('start select ...'); 'use strict'; var inquirer = require('inquirer'); var config = require('../../config/var-app'); var fs = require('fs'); var path = require('path'); inquirer .prompt([ { type: 'list', name: 'appid', message: 'What mini application do you want?', choices: config.APPS } ]) .then(answers => { var appId = answers.appid; var filePath = path.resolve(__dirname, '../../config/var-app.js'); console.log('appid: ' + appId); fs.readFile(filePath, 'utf8', function(err, data) { if (err) return console.log(err); var res = data.replace(/\$appid\s*=\s*\'[^']*\'/g, "$appid = '" + appId + "'"); fs.writeFile(filePath, res, 'utf8', function(err) { if (err) return console.log(err); console.log('select mini application finished!') }); }); }); entry code is: git add -A && git commit -m "test" // this will skip user input; but use 'node ./.githooks/pre-commit/hello.js', everything is ok.
Can solve it temporarily like:
// .githooks/pre-commit/hello #!/bin/sh exec < /dev/tty node ./githooks/scripts/pre-commit.js
// .githooks/scripts/pre-commit.js #!/usr/bin/env node 'use strict'; var inquirer = require('inquirer'); inquirer .prompt([ ... ]) .then(answers => { ... });
Sorry, something went wrong.
No branches or pull requests
same as SBoudrias/Inquirer.js#518,
spawn(hookName, args, {stdio: 'inherit'}) will finish, not wait for user input(by inquirer.js).
my code is:
entry code is:
The text was updated successfully, but these errors were encountered: