diff options
author | Elias Naur <elias.naur@gmail.com> | 2018-05-08 22:59:35 +0200 |
---|---|---|
committer | Elias Naur <elias.naur@gmail.com> | 2018-05-09 07:16:07 +0000 |
commit | 66cb80c266a83313abadbd004b5358c1d1761ed3 (patch) | |
tree | a40cf29eb8ff7cc04f8d29573148c354563bbd47 /misc/ios | |
parent | 337cc2915625728021eaf113fe54e83a5a05530e (diff) | |
download | go-66cb80c266a83313abadbd004b5358c1d1761ed3.tar.gz go-66cb80c266a83313abadbd004b5358c1d1761ed3.zip |
misc/ios: inject the -u device_id option before any other arguments
The idevicedebugserverproxy command takes a port number without a
flag, like so:
idevicedebugserverproxy 3222
If the -u <device_id> flag is added afterwards, it is ignored and
the command use an arbitrary device. Instead, always inject the -u
flag before any other idevice command arguments.
While here, also kill any leftover idevicedebugserverproxy instance
previous (failed) runs might have left running.
Change-Id: I0bf06ed1a20ef225abeca183f9ba8f396662d435
Reviewed-on: https://go-review.googlesource.com/112216
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'misc/ios')
-rw-r--r-- | misc/ios/go_darwin_arm_exec.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/misc/ios/go_darwin_arm_exec.go b/misc/ios/go_darwin_arm_exec.go index 11219ce5c7..7c8b7973ad 100644 --- a/misc/ios/go_darwin_arm_exec.go +++ b/misc/ios/go_darwin_arm_exec.go @@ -137,6 +137,9 @@ func runMain() (int, error) { return 1, err } + // Kill any hanging debug bridges that might take up port 3222. + exec.Command("killall", "idevicedebugserverproxy").Run() + closer, err := startDebugBridge() if err != nil { return 1, err @@ -453,7 +456,9 @@ func install(appdir string) error { func idevCmd(cmd *exec.Cmd) *exec.Cmd { if deviceID != "" { - cmd.Args = append(cmd.Args, "-u", deviceID) + // Inject -u device_id after the executable, but before the arguments. + args := []string{cmd.Args[0], "-u", deviceID} + cmd.Args = append(args, cmd.Args[1:]...) } return cmd } |