Skip to content

Commit

Permalink
debugging the invest subprocess call on Windows. fix natcap#47.
Browse files Browse the repository at this point in the history
  • Loading branch information
davemfish committed Oct 2, 2020
1 parent ddf6818 commit 4dce9bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/InvestJob.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export default class InvestJob extends React.Component {
'--headless',
`-d ${datastackPath}`,
];
// let investRun;
if (process.platform !== 'win32') {
this.investRun = spawn(path.basename(investExe), cmdArgs, {
env: { PATH: path.dirname(investExe) },
Expand All @@ -193,6 +192,7 @@ export default class InvestJob extends React.Component {
});
this.investRun.terminate = () => {
if (this.state.jobStatus === 'running') {
// the '-' prefix on pid sends signal to children as well
process.kill(-this.investRun.pid, 'SIGTERM');
}
};
Expand All @@ -203,6 +203,7 @@ export default class InvestJob extends React.Component {
});
this.investRun.terminate = () => {
if (this.state.jobStatus === 'running') {
// the process.kill with '-' did not do the job on windows
exec(`taskkill /pid ${this.investRun.pid} /t /f`)
}
};
Expand Down

0 comments on commit 4dce9bc

Please sign in to comment.