internal/version: ignore signals intended for the child process

Since the underlying toolchain is run as a child process (and not
exec'd), signals that are sent to this process (for example, an
interrupt sent by a shell) will be handled by both the parent and the
child. This poses a problem for signals like SIGQUIT, where both
processes' runtimes attempt to write out information to the same output.

Before running the final command, start a signal handler that will
ignore a signal sent to the parent, emulating the behavior of go run.

This code is a modified version of cmd/go/internal/base.

Fixes golang/go#36976.

Change-Id: I29aa699dc059fd448aa9478f729ed8d90379616b
Reviewed-on: https://go-review.googlesource.com/c/dl/+/217765
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
3 files changed
tree: b1cfef3376703baf7265ecae10477ee76c5e7077
  1. go1.10/
  2. go1.10.1/
  3. go1.10.2/
  4. go1.10.3/
  5. go1.10.4/
  6. go1.10.5/
  7. go1.10.6/
  8. go1.10.7/
  9. go1.10.8/
  10. go1.10beta1/
  11. go1.10beta2/
  12. go1.10rc1/
  13. go1.10rc2/
  14. go1.11/
  15. go1.11.1/
  16. go1.11.10/
  17. go1.11.11/
  18. go1.11.12/
  19. go1.11.13/
  20. go1.11.2/
  21. go1.11.3/
  22. go1.11.4/
  23. go1.11.5/
  24. go1.11.6/
  25. go1.11.7/
  26. go1.11.8/
  27. go1.11.9/
  28. go1.11beta1/
  29. go1.11beta2/
  30. go1.11beta3/
  31. go1.11rc1/
  32. go1.11rc2/
  33. go1.12/
  34. go1.12.1/
  35. go1.12.10/
  36. go1.12.11/
  37. go1.12.12/
  38. go1.12.13/
  39. go1.12.14/
  40. go1.12.15/
  41. go1.12.16/
  42. go1.12.17/
  43. go1.12.2/
  44. go1.12.3/
  45. go1.12.4/
  46. go1.12.5/
  47. go1.12.6/
  48. go1.12.7/
  49. go1.12.8/
  50. go1.12.9/
  51. go1.12beta1/
  52. go1.12beta2/
  53. go1.12rc1/
  54. go1.13/
  55. go1.13.1/
  56. go1.13.10/
  57. go1.13.11/
  58. go1.13.12/
  59. go1.13.13/
  60. go1.13.14/
  61. go1.13.15/
  62. go1.13.2/
  63. go1.13.3/
  64. go1.13.4/
  65. go1.13.5/
  66. go1.13.6/
  67. go1.13.7/
  68. go1.13.8/
  69. go1.13.9/
  70. go1.13beta1/
  71. go1.13rc1/
  72. go1.13rc2/
  73. go1.14/
  74. go1.14.1/
  75. go1.14.10/
  76. go1.14.11/
  77. go1.14.12/
  78. go1.14.13/
  79. go1.14.14/
  80. go1.14.15/
  81. go1.14.2/
  82. go1.14.3/
  83. go1.14.4/
  84. go1.14.5/
  85. go1.14.6/
  86. go1.14.7/
  87. go1.14.8/
  88. go1.14.9/
  89. go1.14beta1/
  90. go1.14rc1/
  91. go1.15/
  92. go1.15.1/
  93. go1.15.10/
  94. go1.15.2/
  95. go1.15.3/
  96. go1.15.4/
  97. go1.15.5/
  98. go1.15.6/
  99. go1.15.7/
  100. go1.15.8/
  101. go1.15.9/
  102. go1.15beta1/
  103. go1.15rc1/
  104. go1.15rc2/
  105. go1.16/
  106. go1.16.1/
  107. go1.16.2/
  108. go1.16beta1/
  109. go1.16rc1/
  110. go1.5.4/
  111. go1.6.4/
  112. go1.7.6/
  113. go1.8/
  114. go1.8.1/
  115. go1.8.2/
  116. go1.8.3/
  117. go1.8.4/
  118. go1.8.5/
  119. go1.8.6/
  120. go1.8.7/
  121. go1.8beta1/
  122. go1.8beta2/
  123. go1.8rc1/
  124. go1.8rc2/
  125. go1.8rc3/
  126. go1.9/
  127. go1.9.1/
  128. go1.9.2/
  129. go1.9.3/
  130. go1.9.4/
  131. go1.9.5/
  132. go1.9.6/
  133. go1.9.7/
  134. go1.9beta1/
  135. go1.9beta2/
  136. go1.9rc1/
  137. go1.9rc2/
  138. gotip/
  139. internal/
  140. AUTHORS
  141. codereview.cfg
  142. CONTRIBUTING.md
  143. CONTRIBUTORS
  144. go.mod
  145. LICENSE
  146. PATENTS
  147. README.md
README.md

golang.org/dl

This repository holds the Go wrapper programs that run specific versions of Go, such as go get golang.org/dl/go1.10.3 and go get golang.org/dl/gotip.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the net repository is located at https://github.com/golang/go/issues. Prefix your issue with “dl:” in the subject line, so it is easy to find.