Skip to content

Commit 2f8c9cd

Browse files
committed
Merge branch 'topic/regr' into 'master'
Always prepend ./ to main commands See merge request eng/ide/ada_language_server!1708
2 parents f53a90d + c732d35 commit 2f8c9cd

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

integration/vscode/ada/src/taskProviders.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,19 +409,25 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
409409
taskGroup: vscode.TaskGroup.Build,
410410
};
411411

412-
let execPath = main.execRelPath();
412+
let execRelPath = main.execRelPath();
413413
/**
414-
* If the exec is directly at the root of the workspace,
415-
* prepend ./ to make it possible for shells to execute it.
414+
* Always prepend ./ to the relative path. When the path
415+
* only has one component, ./ is necessary for the shell to
416+
* spawn the executable. We choose to always prepend ./ for
417+
* consistency.
418+
*
419+
* We can't use path.join() because it calls
420+
* path.normalize() which removes ./
421+
*
422+
* We use path.normalize() to make sure the path uses
423+
* platform-specific separators.
416424
*/
417-
if (!execPath.includes(path.sep)) {
418-
execPath = './' + execPath;
419-
}
425+
execRelPath = '.' + path.sep + path.normalize(execRelPath);
420426
const runTask: PredefinedTask = {
421427
label: getRunTaskPlainName(main),
422428
taskDef: {
423429
type: this.taskType,
424-
command: execPath,
430+
command: execRelPath,
425431
args: [],
426432
},
427433
};

integration/vscode/ada/test/suite/general/tasks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ ada: Check current file - gprbuild -q -f -c -u -gnatc -P ${projectPath} \${fileB
7171
ada: Compile current file - gprbuild -q -f -c -u -P ${projectPath} \${fileBasename} -cargs:ada -gnatef
7272
ada: Generate documentation from the project - gnatdoc -P ${projectPath}
7373
ada: Build main - src/main1.adb - gprbuild -P ${projectPath} src/main1.adb -cargs:ada -gnatef
74-
ada: Run main - src/main1.adb - obj/main1exec${exe}
74+
ada: Run main - src/main1.adb - .${path.sep}obj${path.sep}main1exec${exe}
7575
ada: Build main - src/test.adb - gprbuild -P ${projectPath} src/test.adb -cargs:ada -gnatef
76-
ada: Run main - src/test.adb - obj/test${exe}
76+
ada: Run main - src/test.adb - .${path.sep}obj${path.sep}test${exe}
7777
`.trim();
7878

7979
const prov = createAdaTaskProvider();

0 commit comments

Comments
 (0)