Skip to content

Commit

Permalink
[patch] fix ignite generator invoking to support windows user dir wit…
Browse files Browse the repository at this point in the history
…h space (#910)

* fix ignite generator invoking to support windows user dir with space

* code review
  • Loading branch information
didi0613 authored and jchip committed Aug 23, 2018
1 parent d2136ba commit fec1a18
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions packages/electrode-ignite/lib/do-yo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ module.exports = Object.assign(Lib, {
platform: {
win32: function win32(name) {
baseYoPath = baseYoPath || __dirname;
const yoPath = Path.join(
baseYoPath,
"..",
"node_modules",
".bin",
"yo.cmd"
);
const yoPath = Path.join(baseYoPath, "..", "node_modules", ".bin", "yo.cmd");

return childProcess.spawn("cmd", ["/c", `${yoPath} ${name}`], {
return childProcess.spawn("cmd", ["/c", yoPath, name], {
stdio: "inherit"
});
},
Expand All @@ -37,11 +31,7 @@ module.exports = Object.assign(Lib, {
},

run: function run(name, platform) {
const platformRun = _.get(
Lib,
["platform", platform || process.platform],
Lib.platform.posix
);
const platformRun = _.get(Lib, ["platform", platform || process.platform], Lib.platform.posix);
const child = platformRun(name);

child.on("error", err => {
Expand All @@ -51,18 +41,14 @@ module.exports = Object.assign(Lib, {
/*
* Avoid the hanging case when child process exits on its own by any reason.
*/
child.on("exit", (code) => {
child.on("exit", code => {
if (code === 0) {
logger.log(
chalk.green(
`Generator: ${name} exited without any errors.`
)
);
logger.log(chalk.green(`Generator: ${name} exited without any errors.`));
} else {
logger.log(
chalk.red(
`Generator: ${name} failed with exit code ${code}.`
+ ` This could mean that it didn't generate your app properly. Please double check.`
`Generator: ${name} failed with exit code ${code}.` +
` This could mean that it didn't generate your app properly. Please double check.`
)
);
}
Expand Down

0 comments on commit fec1a18

Please sign in to comment.