• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 18504233432

14 Oct 2025 05:04PM UTC coverage: 68.422% (+0.01%) from 68.41%
18504233432

Pull #1524

github

web-flow
Merge 0eb5e38ec into b309de3bf
Pull Request #1524: #908: omit git error messages when retrieving status.

3443 of 5513 branches covered (62.45%)

Branch coverage included in aggregate %.

9005 of 12680 relevant lines covered (71.02%)

3.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
cli/src/main/java/com/devonfw/tools/ide/process/ProcessMode.java
1
package com.devonfw.tools.ide.process;
2

3
import java.lang.ProcessBuilder.Redirect;
4

5
/**
6
 * The ProcessMode defines how to start the command process and how output streams are handled using {@link ProcessBuilder}. Modes that can be used:
7
 * {@link #BACKGROUND} {@link #BACKGROUND_SILENT} {@link #DEFAULT} {@link #DEFAULT_CAPTURE}
8
 */
9
public enum ProcessMode {
3✔
10
  /**
11
   * The process of the command will be run like a background process. Technically the parent process will simply not await its child process and a shell is
12
   * used to start the process. The parent process will get the output of the child process using {@link ProcessBuilder.Redirect#INHERIT}. In Unix systems the
13
   * equivalent of appending an '& disown' is used to detach the subprocess from its parent process. In Unix terms, the shell will not send a SIGHUP signal but
14
   * the process remains connected to the terminal so that output is still received. (Only '&' is not used because it just removes awaiting but not sending of
15
   * SIGHUP. Using nohup would simply result in redirecting output to a nohup.out file.)
16
   */
17
  BACKGROUND {
11✔
18
    @Override
19
    public Redirect getRedirectOutput() {
20
      return Redirect.INHERIT;
2✔
21
    }
22

23
    @Override
24
    public Redirect getRedirectError() {
25
      return Redirect.INHERIT;
2✔
26
    }
27

28
    @Override
29
    public Redirect getRedirectInput() {
30
      return null;
2✔
31
    }
32
  },
33
  /**
34
   * Like {@link #BACKGROUND}. Instead of redirecting the output to the parent process, the output is redirected to the 'null file' using
35
   * {@link ProcessBuilder.Redirect#DISCARD}.
36
   */
37
  BACKGROUND_SILENT {
11✔
38
    @Override
39
    public Redirect getRedirectOutput() {
40
      return Redirect.DISCARD;
2✔
41
    }
42

43
    @Override
44
    public Redirect getRedirectError() {
45
      return Redirect.DISCARD;
2✔
46
    }
47

48
    @Override
49
    public Redirect getRedirectInput() {
50
      return null;
2✔
51
    }
52
  },
53
  /**
54
   * The process will be started according {@link ProcessBuilder.Redirect#INHERIT} without any detaching of parent process and child process. This setting makes
55
   * the child process dependant from the parent process! (If you close the parent process the child process will also be terminated.)
56
   */
57
  DEFAULT {
11✔
58
    @Override
59
    public Redirect getRedirectOutput() {
60
      return Redirect.INHERIT;
2✔
61
    }
62

63
    @Override
64
    public Redirect getRedirectError() {
65
      return Redirect.INHERIT;
2✔
66
    }
67

68
    @Override
69
    public Redirect getRedirectInput() {
70
      return Redirect.INHERIT;
2✔
71
    }
72

73
  },
74
  /**
75
   * The process will be started according {@link ProcessBuilder.Redirect#PIPE} and the standard output and standard error streams will be captured from the
76
   * parent process. In other words, they will be printed in the console of the parent process. This setting makes the child process dependant from the parent
77
   * process! (If you close the parent process the child process will also be terminated.)
78
   */
79
  DEFAULT_CAPTURE {
11✔
80
    @Override
81
    public Redirect getRedirectOutput() {
82
      return Redirect.PIPE;
2✔
83
    }
84

85
    @Override
86
    public Redirect getRedirectError() {
87
      return Redirect.PIPE;
2✔
88
    }
89

90
    @Override
91
    public Redirect getRedirectInput() {
92
      return null;
2✔
93
    }
94

95
  },
96

97
  /**
98
   * Like {@link #DEFAULT} the parent and child process will not be detached, the subprocess output will be discarded (to the operating system "null file" )
99
   * using {@link ProcessBuilder.Redirect#DISCARD}.
100
   */
101
  DEFAULT_SILENT {
11✔
102
    @Override
103
    public Redirect getRedirectOutput() {
104

105
      return Redirect.DISCARD;
×
106
    }
107

108
    @Override
109
    public Redirect getRedirectError() {
110

111
      return Redirect.DISCARD;
×
112
    }
113

114
    @Override
115
    public Redirect getRedirectInput() {
116

117
      return Redirect.INHERIT;
×
118
    }
119
  },
120

121
  /**
122
   * Like {@link #DEFAULT_CAPTURE} the parent and child process will not be detached, the subprocess error will be discarded (to the operating system "null file" )
123
   * using {@link ProcessBuilder.Redirect#DISCARD}.
124
   */
125
  CAPTURE_IGNORE_ERROR {
11✔
126
    @Override
127
    public Redirect getRedirectOutput() {
128

129
      return Redirect.PIPE;
×
130
    }
131

132
    @Override
133
    public Redirect getRedirectError() {
134

135
      return Redirect.DISCARD;
×
136
    }
137

138
    @Override
139
    public Redirect getRedirectInput() {
140

141
      return Redirect.INHERIT;
×
142
    }
143
  };
144

145
  /**
146
   * Method to return the {@link ProcessBuilder.Redirect} strategy for the standard output stream of the process. Depending on the mode, the output may be
147
   * inherited from the parent process, discarded, or piped for programmatic access.
148
   *
149
   * @return the {@link ProcessBuilder.Redirect} configuration for standard output, or {@code null} if no redirection is specified.
150
   */
151
  public abstract Redirect getRedirectOutput();
152

153
  /**
154
   * Method to return the {@link ProcessBuilder.Redirect} strategy for the standard error stream of the process. Depending on the mode, the error output may be
155
   * inherited from the parent process, discarded, or piped for programmatic access.
156
   *
157
   * @return the {@link ProcessBuilder.Redirect} configuration for standard error, or {@code null} if no redirection is specified.
158
   */
159
  public abstract Redirect getRedirectError();
160

161
  /**
162
   * Method to return the {@link ProcessBuilder.Redirect} strategy for the standard input stream of the process. Depending on the mode, the input may be
163
   * inherited from the parent process or left unconfigured.
164
   *
165
   * @return the {@link ProcessBuilder.Redirect} configuration for standard input, or {@code null} if no redirection is specified.
166
   */
167
  public abstract Redirect getRedirectInput();
168

169

170
  /**
171
   * Method to check if the ProcessMode is a background process.
172
   *
173
   * @return {@code true} if the {@link ProcessMode} is {@link ProcessMode#BACKGROUND} or {@link ProcessMode#BACKGROUND_SILENT}, {@code false} if not.
174
   */
175
  public boolean isBackground() {
176

177
    return this == BACKGROUND || this == BACKGROUND_SILENT;
10✔
178
  }
179

180
  // TODO ADD EXTERNAL_WINDOW_MODE IN FUTURE Issue: https://github.com/devonfw/IDEasy/issues/218
181

182
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc