Skip to content

Commit

Permalink
Resolution to Issue marc0der#9. PID on Windows OS
Browse files Browse the repository at this point in the history
  • Loading branch information
echovue committed Nov 30, 2016
1 parent f88c36c commit 02cf2d7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ class SpawnProcessTask extends DefaultSpawnTask {
}

private int extractPidFromProcess(Process process) {
def pidField = process.class.getDeclaredField('pid')
def pidIdentifier = isWindowsOS() ? 'handle' : 'pid'
def pidField = process.class.getDeclaredField(pidIdentifier)
pidField.accessible = true

return pidField.getInt(process)
}

private boolean isWindowsOS() {
return System.properties['os.name'].toLowerCase().contains('windows')
}
}

0 comments on commit 02cf2d7

Please sign in to comment.