Skip to content

Commit

Permalink
Merge pull request #282 from HastingsGreer/patch-1
Browse files Browse the repository at this point in the history
Modify itk-js-cli.js to call git bash on windows
  • Loading branch information
thewtex authored Nov 15, 2019
2 parents d714374 + e1ea4f3 commit 451131d
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions src/itk-js-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,28 @@ const build = (sourceDir) => {
if (hypenIndex !== -1) {
cmakeArgs = program.rawArgs.slice(hypenIndex + 1)
}
if(process.platform === "win32"){
var dockerBuild = spawnSync('"C:\\Program Files\\Git\\bin\\sh.exe"',
["--login", "-i", "-c", '"web-build/itk-js-build-env web-build ' + cmakeArgs + '"'], {
env: process.env,
stdio: 'inherit',
shell: true
});

const dockerBuild = spawnSync('bash', [dockcrossScript, 'web-build'].concat(cmakeArgs), {
env: process.env,
stdio: 'inherit'
})
process.exit(dockerBuild.status)
if (dockerBuild.status !== 0) {
console.error(dockerBuild.error);
}
process.exit(dockerBuild.status);
} else {
const dockerBuild = spawnSync('bash', [dockcrossScript, 'web-build'].concat(cmakeArgs), {
env: process.env,
stdio: 'inherit'
})
if (dockerBuild.status !== 0) {
console.error(dockerBuild.error);
}
process.exit(dockerBuild.status)
}
}

const test = (sourceDir) => {
Expand Down Expand Up @@ -104,15 +120,28 @@ const test = (sourceDir) => {
if (hypenIndex !== -1) {
ctestArgs = program.rawArgs.slice(hypenIndex + 1).join(' ')
}

const dockerBuild = spawnSync('bash', [dockcrossScript,
'bash', '-c',
'cd web-build && ctest ' + ctestArgs],
{
if(process.platform === "win32"){
var dockerBuild = spawnSync('"C:\\Program Files\\Git\\bin\\sh.exe"',
["--login", "-i", "-c", '"web-build/itk-js-build-env bash -c cd web-build && ctest ' + cmakeArgs + '"'], {
env: process.env,
stdio: 'inherit'
})
process.exit(dockerBuild.status)
stdio: 'inherit',
shell: true
});

if (dockerBuild.status !== 0) {
console.error(dockerBuild.error);
}
process.exit(dockerBuild.status);
} else {
const dockerBuild = spawnSync('bash', [dockcrossScript,
'bash', '-c',
'cd web-build && ctest ' + ctestArgs],
{
env: process.env,
stdio: 'inherit'
})
process.exit(dockerBuild.status)
}
}

program
Expand Down

0 comments on commit 451131d

Please sign in to comment.