Skip to content

Commit

Permalink
Merge pull request #12 from 5eraph/master
Browse files Browse the repository at this point in the history
Dont panic if dll not available
  • Loading branch information
iamacarpet authored May 20, 2020
2 parents ae7e53a + 972926e commit c5e4f37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions winpty_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (

func createAgentCfg(flags uint32) (uintptr, error) {
var errorPtr uintptr

err := winpty_error_free.Find() // check if dll available
if err != nil {
return uintptr(0), err
}

defer winpty_error_free.Call(errorPtr)

agentCfg, _, _ := winpty_config_new.Call(
Expand Down
6 changes: 6 additions & 0 deletions winpty_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (

func createAgentCfg(flags uint32) (uintptr, error) {
var errorPtr uintptr

err := winpty_error_free.Find() // check if dll available
if err != nil {
return uintptr(0), err
}

defer winpty_error_free.Call(errorPtr)

agentCfg, _, _ := winpty_config_new.Call(uintptr(flags), uintptr(unsafe.Pointer(errorPtr)))
Expand Down

0 comments on commit c5e4f37

Please sign in to comment.