18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2008, 2021 , Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2008, 2022 , Oracle and/or its affiliates. All rights reserved.
22
22
* Portions Copyright (c) 2019, Chris Fraire <[email protected] >.
23
23
*/
24
24
package org .opengrok .indexer .util ;
@@ -63,7 +63,7 @@ public class Executor {
63
63
private final File workingDirectory ;
64
64
private byte [] stdout ;
65
65
private byte [] stderr ;
66
- private int timeout ; // in seconds , 0 means no timeout
66
+ private int timeout ; // in milliseconds , 0 means no timeout
67
67
68
68
/**
69
69
* Create a new instance of the Executor.
@@ -83,14 +83,18 @@ public Executor(List<String> cmdList) {
83
83
84
84
/**
85
85
* Create a new instance of the Executor with default command timeout value.
86
+ * The timeout value will be based on the running context (indexer or web application).
86
87
* @param cmdList A list containing the command to execute
87
88
* @param workingDirectory The directory the process should have as the
88
89
* working directory
89
90
*/
90
91
public Executor (List <String > cmdList , File workingDirectory ) {
92
+ RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
93
+ int timeoutSec = env .isIndexer () ? env .getIndexerCommandTimeout () : env .getInteractiveCommandTimeout ();
94
+
91
95
this .cmdList = cmdList ;
92
96
this .workingDirectory = workingDirectory ;
93
- this .timeout = RuntimeEnvironment . getInstance (). getIndexerCommandTimeout () * 1000 ;
97
+ this .timeout = timeoutSec * 1000 ;
94
98
}
95
99
96
100
/**
0 commit comments