@theia/task 1.19.0 → 1.21.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/process/process-task-resolver.js +2 -1
- package/lib/browser/process/process-task-resolver.js.map +1 -1
- package/lib/browser/task-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/task-frontend-contribution.js +22 -22
- package/lib/browser/task-frontend-contribution.js.map +1 -1
- package/lib/node/process/process-task-runner.d.ts +21 -5
- package/lib/node/process/process-task-runner.d.ts.map +1 -1
- package/lib/node/process/process-task-runner.js +84 -76
- package/lib/node/process/process-task-runner.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/process/process-task-resolver.ts +1 -1
- package/src/browser/task-frontend-contribution.ts +23 -23
- package/src/node/process/process-task-runner.ts +98 -83
|
@@ -38,6 +38,7 @@ let ProcessTaskResolver = class ProcessTaskResolver {
|
|
|
38
38
|
* sane default values. Also, resolve all known variables, e.g. `${workspaceFolder}`.
|
|
39
39
|
*/
|
|
40
40
|
async resolveTask(taskConfig) {
|
|
41
|
+
var _a;
|
|
41
42
|
const type = taskConfig.taskType || taskConfig.type;
|
|
42
43
|
if (type !== 'process' && type !== 'shell') {
|
|
43
44
|
throw new Error('Unsupported task configuration type.');
|
|
@@ -68,7 +69,7 @@ let ProcessTaskResolver = class ProcessTaskResolver {
|
|
|
68
69
|
options: processTaskConfig.linux.options
|
|
69
70
|
} : undefined, options: {
|
|
70
71
|
cwd: await this.variableResolverService.resolve(cwd, variableResolverOptions),
|
|
71
|
-
env: processTaskConfig.options && processTaskConfig.options.env,
|
|
72
|
+
env: ((_a = processTaskConfig.options) === null || _a === void 0 ? void 0 : _a.env) && await this.variableResolverService.resolve(processTaskConfig.options.env, variableResolverOptions),
|
|
72
73
|
shell: processTaskConfig.options && processTaskConfig.options.shell
|
|
73
74
|
} });
|
|
74
75
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-task-resolver.js","sourceRoot":"","sources":["../../../src/browser/process/process-task-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,4DAAkE;AAClE,kEAA+E;AAI/E,0EAAqE;AACrE,oDAA6C;AAC7C,0DAAgE;AAGhE,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAW5B;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,UAA6B
|
|
1
|
+
{"version":3,"file":"process-task-resolver.js","sourceRoot":"","sources":["../../../src/browser/process/process-task-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,4DAAkE;AAClE,kEAA+E;AAI/E,0EAAqE;AACrE,oDAA6C;AAC7C,0DAAgE;AAGhE,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAW5B;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,UAA6B;;QAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC;QACpD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SAC3D;QACD,MAAM,OAAO,GAAG,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,aAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/F,MAAM,uBAAuB,GAAG;YAC5B,OAAO,EAAE,oBAAoB,EAAE,OAAO;SACzC,CAAC;QACF,MAAM,iBAAiB,GAAG,UAAsC,CAAC;QACjE,IAAI,GAAG,GAAG,iBAAiB,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC;QACrE,IAAI,CAAC,GAAG,EAAE;YACN,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC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frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/task-frontend-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"task-frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/task-frontend-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAO,MAAM,wBAAwB,CAAC;AAChK,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC7H,OAAO,EACH,mBAAmB,EAAE,+BAA+B,EAAE,uBAAuB,EAC7E,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,SAAS,EACxE,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAqB,WAAW,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAElF,yBAAiB,YAAY,CAAC;IAGnB,MAAM,QAAQ,SAInB,CAAC;IAEI,MAAM,cAAc,SAIzB,CAAC;IAEI,MAAM,aAAa,SAIxB,CAAC;IAEI,MAAM,kBAAkB,S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BAA2B,CAAC;IAG5E,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAGxC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;cAGtC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC,OAAO,IAAI,IAAI;IAef,MAAM,IAAI,IAAI;IAKd;;;OAGG;cACa,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBvD,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAqHjD,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAuD7C,2BAA2B,IAAI,IAAI;IAInC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;CAO7D"}
|
|
@@ -39,47 +39,47 @@ const browser_2 = require("@theia/editor/lib/browser");
|
|
|
39
39
|
const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
|
|
40
40
|
var TaskCommands;
|
|
41
41
|
(function (TaskCommands) {
|
|
42
|
-
const TASK_CATEGORY_KEY = 'vscode/settingsLayout/task';
|
|
43
42
|
const TASK_CATEGORY = 'Task';
|
|
44
|
-
|
|
43
|
+
const TASK_CATEGORY_KEY = common_1.nls.getDefaultKey(TASK_CATEGORY);
|
|
44
|
+
TaskCommands.TASK_RUN = common_1.Command.toDefaultLocalizedCommand({
|
|
45
45
|
id: 'task:run',
|
|
46
46
|
category: TASK_CATEGORY,
|
|
47
47
|
label: 'Run Task...'
|
|
48
|
-
}
|
|
49
|
-
TaskCommands.TASK_RUN_BUILD = common_1.Command.
|
|
48
|
+
});
|
|
49
|
+
TaskCommands.TASK_RUN_BUILD = common_1.Command.toDefaultLocalizedCommand({
|
|
50
50
|
id: 'task:run:build',
|
|
51
51
|
category: TASK_CATEGORY,
|
|
52
|
-
label: 'Run Build Task
|
|
53
|
-
}
|
|
54
|
-
TaskCommands.TASK_RUN_TEST = common_1.Command.
|
|
52
|
+
label: 'Run Build Task'
|
|
53
|
+
});
|
|
54
|
+
TaskCommands.TASK_RUN_TEST = common_1.Command.toDefaultLocalizedCommand({
|
|
55
55
|
id: 'task:run:test',
|
|
56
56
|
category: TASK_CATEGORY,
|
|
57
|
-
label: 'Run Test Task
|
|
58
|
-
}
|
|
57
|
+
label: 'Run Test Task'
|
|
58
|
+
});
|
|
59
59
|
TaskCommands.WORKBENCH_RUN_TASK = common_1.Command.toLocalizedCommand({
|
|
60
60
|
id: 'workbench.action.tasks.runTask',
|
|
61
61
|
category: TASK_CATEGORY
|
|
62
62
|
}, '', TASK_CATEGORY_KEY);
|
|
63
|
-
TaskCommands.TASK_RUN_LAST = common_1.Command.
|
|
63
|
+
TaskCommands.TASK_RUN_LAST = common_1.Command.toDefaultLocalizedCommand({
|
|
64
64
|
id: 'task:run:last',
|
|
65
65
|
category: TASK_CATEGORY,
|
|
66
|
-
label: '
|
|
67
|
-
}
|
|
66
|
+
label: 'Rerun Last Task'
|
|
67
|
+
});
|
|
68
68
|
TaskCommands.TASK_ATTACH = common_1.Command.toLocalizedCommand({
|
|
69
69
|
id: 'task:attach',
|
|
70
70
|
category: TASK_CATEGORY,
|
|
71
71
|
label: 'Attach Task...'
|
|
72
72
|
}, 'theia/task/attachTask', TASK_CATEGORY_KEY);
|
|
73
|
-
TaskCommands.TASK_RUN_TEXT = common_1.Command.
|
|
73
|
+
TaskCommands.TASK_RUN_TEXT = common_1.Command.toDefaultLocalizedCommand({
|
|
74
74
|
id: 'task:run:text',
|
|
75
75
|
category: TASK_CATEGORY,
|
|
76
76
|
label: 'Run Selected Text'
|
|
77
|
-
}
|
|
78
|
-
TaskCommands.TASK_CONFIGURE = common_1.Command.
|
|
77
|
+
});
|
|
78
|
+
TaskCommands.TASK_CONFIGURE = common_1.Command.toDefaultLocalizedCommand({
|
|
79
79
|
id: 'task:configure',
|
|
80
80
|
category: TASK_CATEGORY,
|
|
81
81
|
label: 'Configure Tasks...'
|
|
82
|
-
}
|
|
82
|
+
});
|
|
83
83
|
TaskCommands.TASK_OPEN_USER = common_1.Command.toLocalizedCommand({
|
|
84
84
|
id: 'task:open_user',
|
|
85
85
|
category: TASK_CATEGORY,
|
|
@@ -90,21 +90,21 @@ var TaskCommands;
|
|
|
90
90
|
category: TASK_CATEGORY,
|
|
91
91
|
label: 'Clear History'
|
|
92
92
|
}, 'theia/task/clearHistory', TASK_CATEGORY_KEY);
|
|
93
|
-
TaskCommands.TASK_SHOW_RUNNING = common_1.Command.
|
|
93
|
+
TaskCommands.TASK_SHOW_RUNNING = common_1.Command.toDefaultLocalizedCommand({
|
|
94
94
|
id: 'task:show-running',
|
|
95
95
|
category: TASK_CATEGORY,
|
|
96
96
|
label: 'Show Running Tasks'
|
|
97
|
-
}
|
|
98
|
-
TaskCommands.TASK_TERMINATE = common_1.Command.
|
|
97
|
+
});
|
|
98
|
+
TaskCommands.TASK_TERMINATE = common_1.Command.toDefaultLocalizedCommand({
|
|
99
99
|
id: 'task:terminate',
|
|
100
100
|
category: TASK_CATEGORY,
|
|
101
101
|
label: 'Terminate Task'
|
|
102
|
-
}
|
|
103
|
-
TaskCommands.TASK_RESTART_RUNNING = common_1.Command.
|
|
102
|
+
});
|
|
103
|
+
TaskCommands.TASK_RESTART_RUNNING = common_1.Command.toDefaultLocalizedCommand({
|
|
104
104
|
id: 'task:restart-running',
|
|
105
105
|
category: TASK_CATEGORY,
|
|
106
106
|
label: 'Restart Running Task...'
|
|
107
|
-
}
|
|
107
|
+
});
|
|
108
108
|
})(TaskCommands = exports.TaskCommands || (exports.TaskCommands = {}));
|
|
109
109
|
const TASKS_STORAGE_KEY = 'tasks';
|
|
110
110
|
let TaskFrontendContribution = class TaskFrontendContribution {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-frontend-contribution.js","sourceRoot":"","sources":["../../src/browser/task-frontend-contribution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,4DAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"task-frontend-contribution.js","sourceRoot":"","sources":["../../src/browser/task-frontend-contribution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,4DAAwF;AACxF,mDAAgK;AAChK,uDAA6H;AAC7H,qDAGiC;AACjC,2EAAuE;AACvE,2DAAmG;AACnG,iDAA6C;AAC7C,+GAA2F;AAC3F,+DAA0D;AAC1D,sCAA2D;AAC3D,uDAA0D;AAC1D,sFAAkF;AAElF,IAAiB,YAAY,CA+E5B;AA/ED,WAAiB,YAAY;IACzB,MAAM,aAAa,GAAG,MAAM,CAAC;IAC7B,MAAM,iBAAiB,GAAG,YAAG,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAC9C,qBAAQ,GAAG,gBAAO,CAAC,yBAAyB,CAAC;QACtD,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAC;IAEU,2BAAc,GAAG,gBAAO,CAAC,yBAAyB,CAAC;QAC5D,EAAE,EAAE,gBAAgB;QACpB,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,gBAAgB;KAC1B,CAAC,CAAC;IAEU,0BAAa,GAAG,gBAAO,CAAC,yBAAyB,CAAC;QAC3D,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,eAAe;KACzB,CAAC,CAAC;IAEU,+BAAkB,GAAG,gBAAO,CAAC,kBAAkB,CAAC;QACzD,EAAE,EAAE,gCAAgC;QACpC,QAAQ,EAAE,aAAa;KAC1B,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAEb,0BAAa,GAAG,gBAAO,CAAC,yBAAyB,CAAC;QAC3D,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAC;IAEU,wBA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,0BAAW,CAAC;8BACY,0BAAW;6DAAC;AAG5C;IADC,kBAAM,CAAC,uCAAiB,CAAC;8BACQ,uCAAiB;+DAAC;AAGpD;IADC,kBAAM,CAAC,wBAAc,CAAC;;gEAC2B;AAGlD;IADC,kBAAM,CAAC,sCAAoB,CAAC;8BACY,sCAAoB;sEAAC;AAG9D;IADC,kBAAM,CAAC,wCAAsB,CAAC;8BACY,wCAAsB;wEAAC;AAGlE;IADC,kBAAM,CAAC,6CAA2B,CAAC;8BACY,6CAA2B;6EAAC;AAG5E;IADC,kBAAM,CAAC,oBAAW,CAAC;8BACY,oBAAW;6DAAC;AAG5C;IADC,kBAAM,CAAC,mBAAS,CAAC;;2DACsB;AAGxC;IADC,kBAAM,CAAC,oCAAgB,CAAC;8BACY,oCAAgB;kEAAC;AAGtD;IADC,yBAAa,EAAE;;;;oDAIf;AAxDQ,wBAAwB;IADpC,sBAAU,EAAE;GACA,wBAAwB,CAyRpC;AAzRY,4DAAwB"}
|
|
@@ -14,12 +14,24 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { ILogger } from '@theia/core';
|
|
17
|
-
import { RawProcessFactory, TaskTerminalProcessFactory } from '@theia/process/lib/node';
|
|
18
|
-
import { ShellQuotingFunctions } from '@theia/process/lib/common/shell-quoting';
|
|
17
|
+
import { RawProcessFactory, TerminalProcessOptions, TaskTerminalProcessFactory } from '@theia/process/lib/node';
|
|
18
|
+
import { ShellQuotedString, ShellQuotingFunctions } from '@theia/process/lib/common/shell-quoting';
|
|
19
19
|
import { TaskFactory } from './process-task';
|
|
20
20
|
import { TaskRunner } from '../task-runner';
|
|
21
21
|
import { Task } from '../task';
|
|
22
22
|
import { TaskConfiguration } from '../../common/task-protocol';
|
|
23
|
+
import { CommandOptions } from '../../common/process/task-protocol';
|
|
24
|
+
interface OsSpecificCommand {
|
|
25
|
+
command: string;
|
|
26
|
+
args: Array<string | ShellQuotedString> | undefined;
|
|
27
|
+
options: CommandOptions;
|
|
28
|
+
}
|
|
29
|
+
interface ShellSpecificOptions {
|
|
30
|
+
/** Arguments passed to the shell, aka `command` here. */
|
|
31
|
+
execArgs: string[];
|
|
32
|
+
/** Pack of functions used to escape the `subCommand` and `subArgs` to run in the shell. */
|
|
33
|
+
quotingFunctions?: ShellQuotingFunctions;
|
|
34
|
+
}
|
|
23
35
|
/**
|
|
24
36
|
* Task runner that runs a task as a process or a command inside a shell.
|
|
25
37
|
*/
|
|
@@ -33,8 +45,11 @@ export declare class ProcessTaskRunner implements TaskRunner {
|
|
|
33
45
|
* @param taskConfig task configuration to run a task from. The provided task configuration must have a shape of `CommandProperties`.
|
|
34
46
|
*/
|
|
35
47
|
run(taskConfig: TaskConfiguration, ctx?: string): Promise<Task>;
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
protected getResolvedCommand(taskConfig: TaskConfiguration): TerminalProcessOptions;
|
|
49
|
+
protected buildShellCommand(systemSpecificCommand: OsSpecificCommand, quotingFunctions?: ShellQuotingFunctions): string;
|
|
50
|
+
protected getShellSpecificOptions(command: string): ShellSpecificOptions;
|
|
51
|
+
protected getOsSpecificCommand(taskConfig: TaskConfiguration): OsSpecificCommand;
|
|
52
|
+
protected getCommand(processType: 'process' | 'shell', terminalProcessOptions: TerminalProcessOptions): string | undefined;
|
|
38
53
|
/**
|
|
39
54
|
* This is task specific, to align with VS Code's behavior.
|
|
40
55
|
*
|
|
@@ -47,7 +62,7 @@ export declare class ProcessTaskRunner implements TaskRunner {
|
|
|
47
62
|
* @param shellQuotingOptions
|
|
48
63
|
*/
|
|
49
64
|
protected argumentNeedsQuotes(value: string, shellQuotingOptions: ShellQuotingFunctions): boolean;
|
|
50
|
-
|
|
65
|
+
protected getSystemSpecificCommand(taskConfig: TaskConfiguration, system: 'windows' | 'linux' | 'osx' | undefined): OsSpecificCommand;
|
|
51
66
|
protected asFsPath(uriOrPath: string): string;
|
|
52
67
|
/**
|
|
53
68
|
* @deprecated
|
|
@@ -58,4 +73,5 @@ export declare class ProcessTaskRunner implements TaskRunner {
|
|
|
58
73
|
*/
|
|
59
74
|
protected executableFileExists(filePath: string): Promise<boolean>;
|
|
60
75
|
}
|
|
76
|
+
export {};
|
|
61
77
|
//# sourceMappingURL=process-task-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-task-runner.d.ts","sourceRoot":"","sources":["../../../src/node/process/process-task-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAQlF,OAAO,EAA+B,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EACH,iBAAiB,
|
|
1
|
+
{"version":3,"file":"process-task-runner.d.ts","sourceRoot":"","sources":["../../../src/node/process/process-task-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAQlF,OAAO,EAA+B,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EACH,iBAAiB,EAGjB,sBAAsB,EACtB,0BAA0B,EAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,iBAAiB,EAAE,qBAAqB,EAC3C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAoB,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAItF,UAAU,iBAAiB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC,GAAG,SAAS,CAAC;IACpD,OAAO,EAAE,cAAc,CAAA;CAC1B;AAED,UAAU,oBAAoB;IAC1B,yDAAyD;IACzD,QAAQ,EAAE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oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAO3E"}
|
|
@@ -80,29 +80,13 @@ let ProcessTaskRunner = class ProcessTaskRunner {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
getResolvedCommand(taskConfig) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (core_1.isWindows && taskConfig.windows !== undefined) {
|
|
86
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'windows');
|
|
87
|
-
}
|
|
88
|
-
else if (core_1.isOSX && taskConfig.osx !== undefined) { // on macOS, mac-specific options, if available, take precedence
|
|
89
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'osx');
|
|
90
|
-
}
|
|
91
|
-
else if (!core_1.isWindows && !core_1.isOSX && taskConfig.linux !== undefined) { // on linux, linux-specific options, if available, take precedence
|
|
92
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'linux');
|
|
93
|
-
}
|
|
94
|
-
else { // system-specific options are unavailable, use the default
|
|
95
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, undefined);
|
|
96
|
-
}
|
|
97
|
-
const options = systemSpecificCommand.options;
|
|
83
|
+
const osSpecificCommand = this.getOsSpecificCommand(taskConfig);
|
|
84
|
+
const options = osSpecificCommand.options;
|
|
98
85
|
// Use task's cwd with spawned process and pass node env object to
|
|
99
86
|
// new process, so e.g. we can re-use the system path
|
|
100
87
|
if (options) {
|
|
101
88
|
options.env = Object.assign(Object.assign({}, process.env), (options.env || {}));
|
|
102
89
|
}
|
|
103
|
-
if (typeof systemSpecificCommand.command === 'undefined') {
|
|
104
|
-
throw new Error('The `command` field of a task cannot be undefined.');
|
|
105
|
-
}
|
|
106
90
|
/** Executable to actually spawn. */
|
|
107
91
|
let command;
|
|
108
92
|
/** List of arguments passed to `command`. */
|
|
@@ -128,63 +112,15 @@ let ProcessTaskRunner = class ProcessTaskRunner {
|
|
|
128
112
|
// What's even more funny is that on Windows, node-pty uses a special
|
|
129
113
|
// mechanism to pass complex escaped arguments, via a string.
|
|
130
114
|
//
|
|
131
|
-
// We need to accommodate
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
let execArgs = [];
|
|
136
|
-
/** Pack of functions used to escape the `subCommand` and `subArgs` to run in the shell. */
|
|
137
|
-
let quotingFunctions;
|
|
138
|
-
const { shell } = systemSpecificCommand.options;
|
|
139
|
-
command = shell && shell.executable || shell_process_1.ShellProcess.getShellExecutablePath();
|
|
140
|
-
args = [];
|
|
141
|
-
if (/bash(.exe)?$/.test(command)) {
|
|
142
|
-
quotingFunctions = shell_quoting_1.BashQuotingFunctions;
|
|
143
|
-
execArgs = ['-c'];
|
|
144
|
-
}
|
|
145
|
-
else if (/wsl(.exe)?$/.test(command)) {
|
|
146
|
-
quotingFunctions = shell_quoting_1.BashQuotingFunctions;
|
|
147
|
-
execArgs = ['-e'];
|
|
148
|
-
}
|
|
149
|
-
else if (/cmd(.exe)?$/.test(command)) {
|
|
150
|
-
quotingFunctions = shell_quoting_1.CmdQuotingFunctions;
|
|
151
|
-
execArgs = ['/S', '/C'];
|
|
152
|
-
}
|
|
153
|
-
else if (/(ps|pwsh|powershell)(.exe)?/.test(command)) {
|
|
154
|
-
quotingFunctions = shell_quoting_1.PowershellQuotingFunctions;
|
|
155
|
-
execArgs = ['-c'];
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
quotingFunctions = shell_quoting_1.BashQuotingFunctions;
|
|
159
|
-
execArgs = ['-l', '-c'];
|
|
160
|
-
}
|
|
115
|
+
// We need to accommodate most shells, so we need to get specific.
|
|
116
|
+
const { shell } = osSpecificCommand.options;
|
|
117
|
+
command = (shell === null || shell === void 0 ? void 0 : shell.executable) || shell_process_1.ShellProcess.getShellExecutablePath();
|
|
118
|
+
const { execArgs, quotingFunctions } = this.getShellSpecificOptions(command);
|
|
161
119
|
// Allow overriding shell options from task configuration.
|
|
162
|
-
|
|
163
|
-
args = [...shell.args];
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
args = [...execArgs];
|
|
167
|
-
}
|
|
120
|
+
args = (shell === null || shell === void 0 ? void 0 : shell.args) ? [...shell.args] : [...execArgs];
|
|
168
121
|
// Check if an argument list is defined or not. Empty is ok.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// We want to quote arguments only if needed.
|
|
172
|
-
if (quotingFunctions && typeof arg === 'string' && this.argumentNeedsQuotes(arg, quotingFunctions)) {
|
|
173
|
-
return {
|
|
174
|
-
quoting: "strong" /* Strong */,
|
|
175
|
-
value: arg,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
return arg;
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
shellCommand = shell_quoting_1.createShellCommandLine(commandLineElements, quotingFunctions);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
// No arguments are provided, so `command` is actually the full command line to execute.
|
|
186
|
-
shellCommand = systemSpecificCommand.command;
|
|
187
|
-
}
|
|
122
|
+
/** Shell command to run: */
|
|
123
|
+
const shellCommand = this.buildShellCommand(osSpecificCommand, quotingFunctions);
|
|
188
124
|
if (core_1.isWindows && /cmd(.exe)?$/.test(command)) {
|
|
189
125
|
// Let's take the following command, including an argument containing whitespace:
|
|
190
126
|
// cmd> node -p process.argv 1 2 " 3"
|
|
@@ -212,10 +148,10 @@ let ProcessTaskRunner = class ProcessTaskRunner {
|
|
|
212
148
|
else {
|
|
213
149
|
// When running process tasks, `command` is the executable to run,
|
|
214
150
|
// and `args` are the arguments we want to pass to it.
|
|
215
|
-
command =
|
|
216
|
-
if (Array.isArray(
|
|
151
|
+
command = osSpecificCommand.command;
|
|
152
|
+
if (Array.isArray(osSpecificCommand.args)) {
|
|
217
153
|
// Process task doesn't handle quotation: Normalize arguments from `ShellQuotedString` to raw `string`.
|
|
218
|
-
args =
|
|
154
|
+
args = osSpecificCommand.args.map(arg => typeof arg === 'string' ? arg : arg.value);
|
|
219
155
|
}
|
|
220
156
|
else {
|
|
221
157
|
args = [];
|
|
@@ -223,6 +159,75 @@ let ProcessTaskRunner = class ProcessTaskRunner {
|
|
|
223
159
|
}
|
|
224
160
|
return { command, args, commandLine, options };
|
|
225
161
|
}
|
|
162
|
+
buildShellCommand(systemSpecificCommand, quotingFunctions) {
|
|
163
|
+
var _a;
|
|
164
|
+
if (Array.isArray(systemSpecificCommand.args)) {
|
|
165
|
+
const commandLineElements = [systemSpecificCommand.command, ...systemSpecificCommand.args].map(arg => {
|
|
166
|
+
// We want to quote arguments only if needed.
|
|
167
|
+
if (quotingFunctions && typeof arg === 'string' && this.argumentNeedsQuotes(arg, quotingFunctions)) {
|
|
168
|
+
return {
|
|
169
|
+
quoting: "strong" /* Strong */,
|
|
170
|
+
value: arg,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return arg;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return shell_quoting_1.createShellCommandLine(commandLineElements, quotingFunctions);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
// No arguments are provided, so `command` is actually the full command line to execute.
|
|
181
|
+
return (_a = systemSpecificCommand.command) !== null && _a !== void 0 ? _a : '';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
getShellSpecificOptions(command) {
|
|
185
|
+
if (/bash(.exe)?$/.test(command)) {
|
|
186
|
+
return {
|
|
187
|
+
quotingFunctions: shell_quoting_1.BashQuotingFunctions,
|
|
188
|
+
execArgs: ['-c']
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
else if (/wsl(.exe)?$/.test(command)) {
|
|
192
|
+
return {
|
|
193
|
+
quotingFunctions: shell_quoting_1.BashQuotingFunctions,
|
|
194
|
+
execArgs: ['-e']
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
else if (/cmd(.exe)?$/.test(command)) {
|
|
198
|
+
return {
|
|
199
|
+
quotingFunctions: shell_quoting_1.CmdQuotingFunctions,
|
|
200
|
+
execArgs: ['/S', '/C']
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
else if (/(ps|pwsh|powershell)(.exe)?/.test(command)) {
|
|
204
|
+
return {
|
|
205
|
+
quotingFunctions: shell_quoting_1.PowershellQuotingFunctions,
|
|
206
|
+
execArgs: ['-c']
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
return {
|
|
211
|
+
quotingFunctions: shell_quoting_1.BashQuotingFunctions,
|
|
212
|
+
execArgs: ['-l', '-c']
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
getOsSpecificCommand(taskConfig) {
|
|
217
|
+
// on windows, windows-specific options, if available, take precedence
|
|
218
|
+
if (core_1.isWindows && taskConfig.windows !== undefined) {
|
|
219
|
+
return this.getSystemSpecificCommand(taskConfig, 'windows');
|
|
220
|
+
}
|
|
221
|
+
else if (core_1.isOSX && taskConfig.osx !== undefined) { // on macOS, mac-specific options, if available, take precedence
|
|
222
|
+
return this.getSystemSpecificCommand(taskConfig, 'osx');
|
|
223
|
+
}
|
|
224
|
+
else if (!core_1.isWindows && !core_1.isOSX && taskConfig.linux !== undefined) { // on linux, linux-specific options, if available, take precedence
|
|
225
|
+
return this.getSystemSpecificCommand(taskConfig, 'linux');
|
|
226
|
+
}
|
|
227
|
+
else { // system-specific options are unavailable, use the default
|
|
228
|
+
return this.getSystemSpecificCommand(taskConfig, undefined);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
226
231
|
getCommand(processType, terminalProcessOptions) {
|
|
227
232
|
if (terminalProcessOptions.args) {
|
|
228
233
|
if (processType === 'shell') {
|
|
@@ -299,6 +304,9 @@ let ProcessTaskRunner = class ProcessTaskRunner {
|
|
|
299
304
|
if (options.cwd) {
|
|
300
305
|
options.cwd = this.asFsPath(options.cwd);
|
|
301
306
|
}
|
|
307
|
+
if (command === undefined) {
|
|
308
|
+
throw new Error('The `command` field of a task cannot be undefined.');
|
|
309
|
+
}
|
|
302
310
|
return { command, args, options };
|
|
303
311
|
}
|
|
304
312
|
asFsPath(uriOrPath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-task-runner.js","sourceRoot":"","sources":["../../../src/node/process/process-task-runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF;;;gGAGgG;AAEhG,4DAAyE;AACzE,sCAAmE;AACnE,+CAA+C;AAC/C,kDAMiC;AACjC,2EAEiD;AACjD,iDAA6C;AAI7C,sEAAsF;AACtF,yBAAyB;AACzB,0EAAsE;
|
|
1
|
+
{"version":3,"file":"process-task-runner.js","sourceRoot":"","sources":["../../../src/node/process/process-task-runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF;;;gGAGgG;AAEhG,4DAAyE;AACzE,sCAAmE;AACnE,+CAA+C;AAC/C,kDAMiC;AACjC,2EAEiD;AACjD,iDAA6C;AAI7C,sEAAsF;AACtF,yBAAyB;AACzB,0EAAsE;AAetE;;GAEG;AAEH,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAc1B;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,UAA6B,EAAE,GAAY;QACjD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;SACjF;QACD,IAAI;YACA,uFAAuF;YACvF,6BAA6B;YAC7B,2FAA2F;YAC3F,gGAAgG;YAChG,MAAM,sBAAsB,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAY,IAAI,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,CAAC;YAElF,8FAA8F;YAC9F,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAClC,QAAQ,CAAC,OAAO,CAAC,OAAO,CA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|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/task",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0-next.14+afd980a4d4f",
|
|
4
4
|
"description": "Theia - Task extension. This extension adds support for executing raw or terminal processes in the backend.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/markers": "1.
|
|
10
|
-
"@theia/monaco": "1.
|
|
11
|
-
"@theia/preferences": "1.
|
|
12
|
-
"@theia/process": "1.
|
|
13
|
-
"@theia/terminal": "1.
|
|
14
|
-
"@theia/userstorage": "1.
|
|
15
|
-
"@theia/variable-resolver": "1.
|
|
16
|
-
"@theia/workspace": "1.
|
|
6
|
+
"@theia/core": "1.21.0-next.14+afd980a4d4f",
|
|
7
|
+
"@theia/editor": "1.21.0-next.14+afd980a4d4f",
|
|
8
|
+
"@theia/filesystem": "1.21.0-next.14+afd980a4d4f",
|
|
9
|
+
"@theia/markers": "1.21.0-next.14+afd980a4d4f",
|
|
10
|
+
"@theia/monaco": "1.21.0-next.14+afd980a4d4f",
|
|
11
|
+
"@theia/preferences": "1.21.0-next.14+afd980a4d4f",
|
|
12
|
+
"@theia/process": "1.21.0-next.14+afd980a4d4f",
|
|
13
|
+
"@theia/terminal": "1.21.0-next.14+afd980a4d4f",
|
|
14
|
+
"@theia/userstorage": "1.21.0-next.14+afd980a4d4f",
|
|
15
|
+
"@theia/variable-resolver": "1.21.0-next.14+afd980a4d4f",
|
|
16
|
+
"@theia/workspace": "1.21.0-next.14+afd980a4d4f",
|
|
17
17
|
"ajv": "^6.5.3",
|
|
18
18
|
"async-mutex": "^0.3.1",
|
|
19
19
|
"jsonc-parser": "^2.2.0",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"watch": "theiaext watch"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@theia/ext-scripts": "1.
|
|
56
|
+
"@theia/ext-scripts": "1.20.0"
|
|
57
57
|
},
|
|
58
58
|
"nyc": {
|
|
59
59
|
"extends": "../../configs/nyc.json"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "afd980a4d4ff6b48d70fc0ce1e459f6496c62624"
|
|
62
62
|
}
|
|
@@ -80,7 +80,7 @@ export class ProcessTaskResolver implements TaskResolver {
|
|
|
80
80
|
} : undefined,
|
|
81
81
|
options: {
|
|
82
82
|
cwd: await this.variableResolverService.resolve(cwd, variableResolverOptions),
|
|
83
|
-
env: processTaskConfig.options && processTaskConfig.options.env,
|
|
83
|
+
env: processTaskConfig.options?.env && await this.variableResolverService.resolve(processTaskConfig.options.env, variableResolverOptions),
|
|
84
84
|
shell: processTaskConfig.options && processTaskConfig.options.shell
|
|
85
85
|
}
|
|
86
86
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ILogger, ContributionProvider, CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common';
|
|
18
|
+
import { ILogger, ContributionProvider, CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry, nls } from '@theia/core/lib/common';
|
|
19
19
|
import { QuickOpenTask, TaskTerminateQuickOpen, TaskRunningQuickOpen, TaskRestartRunningQuickOpen } from './quick-open-task';
|
|
20
20
|
import {
|
|
21
21
|
FrontendApplication, FrontendApplicationContribution, QuickAccessContribution,
|
|
@@ -31,36 +31,36 @@ import { EditorManager } from '@theia/editor/lib/browser';
|
|
|
31
31
|
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
32
32
|
|
|
33
33
|
export namespace TaskCommands {
|
|
34
|
-
const TASK_CATEGORY_KEY = 'vscode/settingsLayout/task';
|
|
35
34
|
const TASK_CATEGORY = 'Task';
|
|
36
|
-
|
|
35
|
+
const TASK_CATEGORY_KEY = nls.getDefaultKey(TASK_CATEGORY);
|
|
36
|
+
export const TASK_RUN = Command.toDefaultLocalizedCommand({
|
|
37
37
|
id: 'task:run',
|
|
38
38
|
category: TASK_CATEGORY,
|
|
39
39
|
label: 'Run Task...'
|
|
40
|
-
}
|
|
40
|
+
});
|
|
41
41
|
|
|
42
|
-
export const TASK_RUN_BUILD = Command.
|
|
42
|
+
export const TASK_RUN_BUILD = Command.toDefaultLocalizedCommand({
|
|
43
43
|
id: 'task:run:build',
|
|
44
44
|
category: TASK_CATEGORY,
|
|
45
|
-
label: 'Run Build Task
|
|
46
|
-
}
|
|
45
|
+
label: 'Run Build Task'
|
|
46
|
+
});
|
|
47
47
|
|
|
48
|
-
export const TASK_RUN_TEST = Command.
|
|
48
|
+
export const TASK_RUN_TEST = Command.toDefaultLocalizedCommand({
|
|
49
49
|
id: 'task:run:test',
|
|
50
50
|
category: TASK_CATEGORY,
|
|
51
|
-
label: 'Run Test Task
|
|
52
|
-
}
|
|
51
|
+
label: 'Run Test Task'
|
|
52
|
+
});
|
|
53
53
|
|
|
54
54
|
export const WORKBENCH_RUN_TASK = Command.toLocalizedCommand({
|
|
55
55
|
id: 'workbench.action.tasks.runTask',
|
|
56
56
|
category: TASK_CATEGORY
|
|
57
57
|
}, '', TASK_CATEGORY_KEY);
|
|
58
58
|
|
|
59
|
-
export const TASK_RUN_LAST = Command.
|
|
59
|
+
export const TASK_RUN_LAST = Command.toDefaultLocalizedCommand({
|
|
60
60
|
id: 'task:run:last',
|
|
61
61
|
category: TASK_CATEGORY,
|
|
62
|
-
label: '
|
|
63
|
-
}
|
|
62
|
+
label: 'Rerun Last Task'
|
|
63
|
+
});
|
|
64
64
|
|
|
65
65
|
export const TASK_ATTACH = Command.toLocalizedCommand({
|
|
66
66
|
id: 'task:attach',
|
|
@@ -68,17 +68,17 @@ export namespace TaskCommands {
|
|
|
68
68
|
label: 'Attach Task...'
|
|
69
69
|
}, 'theia/task/attachTask', TASK_CATEGORY_KEY);
|
|
70
70
|
|
|
71
|
-
export const TASK_RUN_TEXT = Command.
|
|
71
|
+
export const TASK_RUN_TEXT = Command.toDefaultLocalizedCommand({
|
|
72
72
|
id: 'task:run:text',
|
|
73
73
|
category: TASK_CATEGORY,
|
|
74
74
|
label: 'Run Selected Text'
|
|
75
|
-
}
|
|
75
|
+
});
|
|
76
76
|
|
|
77
|
-
export const TASK_CONFIGURE = Command.
|
|
77
|
+
export const TASK_CONFIGURE = Command.toDefaultLocalizedCommand({
|
|
78
78
|
id: 'task:configure',
|
|
79
79
|
category: TASK_CATEGORY,
|
|
80
80
|
label: 'Configure Tasks...'
|
|
81
|
-
}
|
|
81
|
+
});
|
|
82
82
|
|
|
83
83
|
export const TASK_OPEN_USER = Command.toLocalizedCommand({
|
|
84
84
|
id: 'task:open_user',
|
|
@@ -92,23 +92,23 @@ export namespace TaskCommands {
|
|
|
92
92
|
label: 'Clear History'
|
|
93
93
|
}, 'theia/task/clearHistory', TASK_CATEGORY_KEY);
|
|
94
94
|
|
|
95
|
-
export const TASK_SHOW_RUNNING = Command.
|
|
95
|
+
export const TASK_SHOW_RUNNING = Command.toDefaultLocalizedCommand({
|
|
96
96
|
id: 'task:show-running',
|
|
97
97
|
category: TASK_CATEGORY,
|
|
98
98
|
label: 'Show Running Tasks'
|
|
99
|
-
}
|
|
99
|
+
});
|
|
100
100
|
|
|
101
|
-
export const TASK_TERMINATE = Command.
|
|
101
|
+
export const TASK_TERMINATE = Command.toDefaultLocalizedCommand({
|
|
102
102
|
id: 'task:terminate',
|
|
103
103
|
category: TASK_CATEGORY,
|
|
104
104
|
label: 'Terminate Task'
|
|
105
|
-
}
|
|
105
|
+
});
|
|
106
106
|
|
|
107
|
-
export const TASK_RESTART_RUNNING = Command.
|
|
107
|
+
export const TASK_RESTART_RUNNING = Command.toDefaultLocalizedCommand({
|
|
108
108
|
id: 'task:restart-running',
|
|
109
109
|
category: TASK_CATEGORY,
|
|
110
110
|
label: 'Restart Running Task...'
|
|
111
|
-
}
|
|
111
|
+
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const TASKS_STORAGE_KEY = 'tasks';
|
|
@@ -40,6 +40,19 @@ import { ProcessTaskError, CommandOptions } from '../../common/process/task-prot
|
|
|
40
40
|
import * as fs from 'fs';
|
|
41
41
|
import { ShellProcess } from '@theia/terminal/lib/node/shell-process';
|
|
42
42
|
|
|
43
|
+
interface OsSpecificCommand {
|
|
44
|
+
command: string,
|
|
45
|
+
args: Array<string | ShellQuotedString> | undefined,
|
|
46
|
+
options: CommandOptions
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface ShellSpecificOptions {
|
|
50
|
+
/** Arguments passed to the shell, aka `command` here. */
|
|
51
|
+
execArgs: string[];
|
|
52
|
+
/** Pack of functions used to escape the `subCommand` and `subArgs` to run in the shell. */
|
|
53
|
+
quotingFunctions?: ShellQuotingFunctions;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
/**
|
|
44
57
|
* Task runner that runs a task as a process or a command inside a shell.
|
|
45
58
|
*/
|
|
@@ -97,24 +110,10 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
command: string | undefined
|
|
103
|
-
args: Array<string | ShellQuotedString> | undefined
|
|
104
|
-
options: CommandOptions
|
|
105
|
-
};
|
|
106
|
-
// on windows, windows-specific options, if available, take precedence
|
|
107
|
-
if (isWindows && taskConfig.windows !== undefined) {
|
|
108
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'windows');
|
|
109
|
-
} else if (isOSX && taskConfig.osx !== undefined) { // on macOS, mac-specific options, if available, take precedence
|
|
110
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'osx');
|
|
111
|
-
} else if (!isWindows && !isOSX && taskConfig.linux !== undefined) { // on linux, linux-specific options, if available, take precedence
|
|
112
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, 'linux');
|
|
113
|
-
} else { // system-specific options are unavailable, use the default
|
|
114
|
-
systemSpecificCommand = this.getSystemSpecificCommand(taskConfig, undefined);
|
|
115
|
-
}
|
|
113
|
+
protected getResolvedCommand(taskConfig: TaskConfiguration): TerminalProcessOptions {
|
|
114
|
+
const osSpecificCommand = this.getOsSpecificCommand(taskConfig);
|
|
116
115
|
|
|
117
|
-
const options =
|
|
116
|
+
const options = osSpecificCommand.options;
|
|
118
117
|
|
|
119
118
|
// Use task's cwd with spawned process and pass node env object to
|
|
120
119
|
// new process, so e.g. we can re-use the system path
|
|
@@ -125,10 +124,6 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
125
124
|
};
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
if (typeof systemSpecificCommand.command === 'undefined') {
|
|
129
|
-
throw new Error('The `command` field of a task cannot be undefined.');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
127
|
/** Executable to actually spawn. */
|
|
133
128
|
let command: string;
|
|
134
129
|
/** List of arguments passed to `command`. */
|
|
@@ -156,63 +151,20 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
156
151
|
// What's even more funny is that on Windows, node-pty uses a special
|
|
157
152
|
// mechanism to pass complex escaped arguments, via a string.
|
|
158
153
|
//
|
|
159
|
-
// We need to accommodate
|
|
154
|
+
// We need to accommodate most shells, so we need to get specific.
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/** Pack of functions used to escape the `subCommand` and `subArgs` to run in the shell. */
|
|
166
|
-
let quotingFunctions: ShellQuotingFunctions | undefined;
|
|
167
|
-
|
|
168
|
-
const { shell } = systemSpecificCommand.options;
|
|
169
|
-
command = shell && shell.executable || ShellProcess.getShellExecutablePath();
|
|
170
|
-
args = [];
|
|
171
|
-
|
|
172
|
-
if (/bash(.exe)?$/.test(command)) {
|
|
173
|
-
quotingFunctions = BashQuotingFunctions;
|
|
174
|
-
execArgs = ['-c'];
|
|
175
|
-
|
|
176
|
-
} else if (/wsl(.exe)?$/.test(command)) {
|
|
177
|
-
quotingFunctions = BashQuotingFunctions;
|
|
178
|
-
execArgs = ['-e'];
|
|
179
|
-
|
|
180
|
-
} else if (/cmd(.exe)?$/.test(command)) {
|
|
181
|
-
quotingFunctions = CmdQuotingFunctions;
|
|
182
|
-
execArgs = ['/S', '/C'];
|
|
183
|
-
|
|
184
|
-
} else if (/(ps|pwsh|powershell)(.exe)?/.test(command)) {
|
|
185
|
-
quotingFunctions = PowershellQuotingFunctions;
|
|
186
|
-
execArgs = ['-c'];
|
|
187
|
-
} else {
|
|
188
|
-
quotingFunctions = BashQuotingFunctions;
|
|
189
|
-
execArgs = ['-l', '-c'];
|
|
156
|
+
const { shell } = osSpecificCommand.options;
|
|
157
|
+
|
|
158
|
+
command = shell?.executable || ShellProcess.getShellExecutablePath();
|
|
159
|
+
const { execArgs, quotingFunctions } = this.getShellSpecificOptions(command);
|
|
190
160
|
|
|
191
|
-
}
|
|
192
161
|
// Allow overriding shell options from task configuration.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
} else {
|
|
196
|
-
args = [...execArgs];
|
|
197
|
-
}
|
|
162
|
+
args = shell?.args ? [...shell.args] : [...execArgs];
|
|
163
|
+
|
|
198
164
|
// Check if an argument list is defined or not. Empty is ok.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (quotingFunctions && typeof arg === 'string' && this.argumentNeedsQuotes(arg, quotingFunctions)) {
|
|
203
|
-
return {
|
|
204
|
-
quoting: ShellQuoting.Strong,
|
|
205
|
-
value: arg,
|
|
206
|
-
};
|
|
207
|
-
} else {
|
|
208
|
-
return arg;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
shellCommand = createShellCommandLine(commandLineElements, quotingFunctions);
|
|
212
|
-
} else {
|
|
213
|
-
// No arguments are provided, so `command` is actually the full command line to execute.
|
|
214
|
-
shellCommand = systemSpecificCommand.command;
|
|
215
|
-
}
|
|
165
|
+
/** Shell command to run: */
|
|
166
|
+
const shellCommand = this.buildShellCommand(osSpecificCommand, quotingFunctions);
|
|
167
|
+
|
|
216
168
|
if (isWindows && /cmd(.exe)?$/.test(command)) {
|
|
217
169
|
// Let's take the following command, including an argument containing whitespace:
|
|
218
170
|
// cmd> node -p process.argv 1 2 " 3"
|
|
@@ -235,14 +187,15 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
235
187
|
// Note the extra quotes that need to be added around the whole command.
|
|
236
188
|
commandLine = [...args, `"${shellCommand}"`].join(' ');
|
|
237
189
|
}
|
|
190
|
+
|
|
238
191
|
args.push(shellCommand);
|
|
239
192
|
} else {
|
|
240
193
|
// When running process tasks, `command` is the executable to run,
|
|
241
194
|
// and `args` are the arguments we want to pass to it.
|
|
242
|
-
command =
|
|
243
|
-
if (Array.isArray(
|
|
195
|
+
command = osSpecificCommand.command;
|
|
196
|
+
if (Array.isArray(osSpecificCommand.args)) {
|
|
244
197
|
// Process task doesn't handle quotation: Normalize arguments from `ShellQuotedString` to raw `string`.
|
|
245
|
-
args =
|
|
198
|
+
args = osSpecificCommand.args.map(arg => typeof arg === 'string' ? arg : arg.value);
|
|
246
199
|
} else {
|
|
247
200
|
args = [];
|
|
248
201
|
}
|
|
@@ -250,7 +203,69 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
250
203
|
return { command, args, commandLine, options };
|
|
251
204
|
}
|
|
252
205
|
|
|
253
|
-
|
|
206
|
+
protected buildShellCommand(systemSpecificCommand: OsSpecificCommand, quotingFunctions?: ShellQuotingFunctions): string {
|
|
207
|
+
if (Array.isArray(systemSpecificCommand.args)) {
|
|
208
|
+
const commandLineElements: Array<string | ShellQuotedString> = [systemSpecificCommand.command, ...systemSpecificCommand.args].map(arg => {
|
|
209
|
+
// We want to quote arguments only if needed.
|
|
210
|
+
if (quotingFunctions && typeof arg === 'string' && this.argumentNeedsQuotes(arg, quotingFunctions)) {
|
|
211
|
+
return {
|
|
212
|
+
quoting: ShellQuoting.Strong,
|
|
213
|
+
value: arg,
|
|
214
|
+
};
|
|
215
|
+
} else {
|
|
216
|
+
return arg;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
return createShellCommandLine(commandLineElements, quotingFunctions);
|
|
220
|
+
} else {
|
|
221
|
+
// No arguments are provided, so `command` is actually the full command line to execute.
|
|
222
|
+
return systemSpecificCommand.command ?? '';
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
protected getShellSpecificOptions(command: string): ShellSpecificOptions {
|
|
227
|
+
if (/bash(.exe)?$/.test(command)) {
|
|
228
|
+
return {
|
|
229
|
+
quotingFunctions: BashQuotingFunctions,
|
|
230
|
+
execArgs: ['-c']
|
|
231
|
+
};
|
|
232
|
+
} else if (/wsl(.exe)?$/.test(command)) {
|
|
233
|
+
return {
|
|
234
|
+
quotingFunctions: BashQuotingFunctions,
|
|
235
|
+
execArgs: ['-e']
|
|
236
|
+
};
|
|
237
|
+
} else if (/cmd(.exe)?$/.test(command)) {
|
|
238
|
+
return {
|
|
239
|
+
quotingFunctions: CmdQuotingFunctions,
|
|
240
|
+
execArgs: ['/S', '/C']
|
|
241
|
+
};
|
|
242
|
+
} else if (/(ps|pwsh|powershell)(.exe)?/.test(command)) {
|
|
243
|
+
return {
|
|
244
|
+
quotingFunctions: PowershellQuotingFunctions,
|
|
245
|
+
execArgs: ['-c']
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
return {
|
|
249
|
+
quotingFunctions: BashQuotingFunctions,
|
|
250
|
+
execArgs: ['-l', '-c']
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
protected getOsSpecificCommand(taskConfig: TaskConfiguration): OsSpecificCommand {
|
|
256
|
+
// on windows, windows-specific options, if available, take precedence
|
|
257
|
+
if (isWindows && taskConfig.windows !== undefined) {
|
|
258
|
+
return this.getSystemSpecificCommand(taskConfig, 'windows');
|
|
259
|
+
} else if (isOSX && taskConfig.osx !== undefined) { // on macOS, mac-specific options, if available, take precedence
|
|
260
|
+
return this.getSystemSpecificCommand(taskConfig, 'osx');
|
|
261
|
+
} else if (!isWindows && !isOSX && taskConfig.linux !== undefined) { // on linux, linux-specific options, if available, take precedence
|
|
262
|
+
return this.getSystemSpecificCommand(taskConfig, 'linux');
|
|
263
|
+
} else { // system-specific options are unavailable, use the default
|
|
264
|
+
return this.getSystemSpecificCommand(taskConfig, undefined);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
protected getCommand(processType: 'process' | 'shell', terminalProcessOptions: TerminalProcessOptions): string | undefined {
|
|
254
269
|
if (terminalProcessOptions.args) {
|
|
255
270
|
if (processType === 'shell') {
|
|
256
271
|
return terminalProcessOptions.args[terminalProcessOptions.args.length - 1];
|
|
@@ -304,11 +319,7 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
304
319
|
return false;
|
|
305
320
|
}
|
|
306
321
|
|
|
307
|
-
|
|
308
|
-
command: string | undefined,
|
|
309
|
-
args: Array<string | ShellQuotedString> | undefined,
|
|
310
|
-
options: CommandOptions
|
|
311
|
-
} {
|
|
322
|
+
protected getSystemSpecificCommand(taskConfig: TaskConfiguration, system: 'windows' | 'linux' | 'osx' | undefined): OsSpecificCommand {
|
|
312
323
|
// initialize with default values from the `taskConfig`
|
|
313
324
|
let command: string | undefined = taskConfig.command;
|
|
314
325
|
let args: Array<string | ShellQuotedString> | undefined = taskConfig.args;
|
|
@@ -330,6 +341,10 @@ export class ProcessTaskRunner implements TaskRunner {
|
|
|
330
341
|
options.cwd = this.asFsPath(options.cwd);
|
|
331
342
|
}
|
|
332
343
|
|
|
344
|
+
if (command === undefined) {
|
|
345
|
+
throw new Error('The `command` field of a task cannot be undefined.');
|
|
346
|
+
}
|
|
347
|
+
|
|
333
348
|
return { command, args, options };
|
|
334
349
|
}
|
|
335
350
|
|