File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -81,5 +81,12 @@ func Command(args ...string) (*exec.Cmd, error) {
8181 }
8282 cmd := exec .Command (args [0 ], args [1 :]... )
8383 TellCommandNotToSpawnShell (cmd )
84+
85+ // This is required because some tools detects if the program is running
86+ // from terminal by looking at the stdin/out bindings.
87+ // https://github.com/arduino/arduino-cli/issues/844
88+ cmd .Stdout = NullWriter
89+ cmd .Stderr = NullWriter
90+ cmd .Stdin = NullReader
8491 return cmd , nil
8592}
Original file line number Diff line number Diff line change 1+ // This file is part of arduino-cli.
2+ //
3+ // Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
4+ //
5+ // This software is released under the GNU General Public License version 3,
6+ // which covers the main part of arduino-cli.
7+ // The terms of this license can be found at:
8+ // https://www.gnu.org/licenses/gpl-3.0.en.html
9+ //
10+ // You can be released from the requirements of the above licenses by purchasing
11+ // a commercial license. Buying such a license is mandatory if you want to
12+ // modify or otherwise use the software for commercial activities involving the
13+ // Arduino software without disclosing the source code of your own applications.
14+ // To purchase a commercial license, send an email to license@arduino.cc.
15+
16+ package executils
17+
18+ import "io"
19+
20+ // NullReader is an io.Reader that will always return EOF
21+ var NullReader = & nullReader {}
22+
23+ type nullReader struct {}
24+
25+ func (r * nullReader ) Read (buff []byte ) (int , error ) {
26+ return 0 , io .EOF
27+ }
28+
29+ // NullWriter is an io.Writer that discards any output
30+ var NullWriter = & nullWriter {}
31+
32+ type nullWriter struct {}
33+
34+ func (r * nullWriter ) Write (buff []byte ) (int , error ) {
35+ return len (buff ), nil
36+ }
You can’t perform that action at this time.
0 commit comments