Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop in extension #336

Open
wants to merge 2 commits into
base: Developer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/kill-process-by-name/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions node_modules/kill-process-by-name/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/kill-process-by-name/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/kill-process-by-name/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"kill-process-by-name": "^1.0.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ rem
rem Assumptions:
rem
rem GnuCOBOL 3.+ is installed and on the path. Its executable or alias or symlink is named "cobc".
%~d1
cd %~p1
cobc -xj %*
%~n1
cobc -xj %*
13 changes: 11 additions & 2 deletions vs-code-extension/client/src/services/CobolCheckLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { integer } from 'vscode-languageclient';
import * as LOGGER from '../utils/Logger'
import * as CobParser from './CobolCheckOutputParser'
import { getConfigurationValueFor } from './CobolCheckConfiguration';
import { subProcess, subProcessSync } from 'subspawn';



const windowsPlatform = 'Windows';
const macPlatform = 'MacOS';
Expand Down Expand Up @@ -71,7 +74,7 @@ export function getCobolCheckRunArgumentsBasedOnSuiteDirectory(vsCodeInstallPath
}

export async function runCobolCheck(path : string, commandLineArgs : string) : Promise<CobParser.CobolCheckOutputParser> {
return new Promise(async resolve => {
return new Promise(async (resolve, reject) => {
// Getting the right command based on platform
let executeJarCommand = '';
if (currentPlatform === windowsPlatform){
Expand All @@ -86,15 +89,21 @@ export async function runCobolCheck(path : string, commandLineArgs : string) : P

LOGGER.log("Running Cobol Check with arguments: " + commandLineArgs, LOGGER.INFO)
try{
var killProcess = require('kill-process-by-name');
let maxWaitMillisec = vscode.workspace.getConfiguration("cut").maxWaitTime;
LOGGER.log("MAX WAIT TIME SET TO: " + maxWaitMillisec, LOGGER.INFO);
var exec = require('child_process').exec;
const testPath = appendPath(externalVsCodeInstallationDir, "Cobol-check");
// fix for MacOS
const tmpStr = "cd " + testPath + " && "

//Run Cobol Check jar with arguments
var child = exec(tmpStr + executeJarCommand + ' ' + commandLineArgs, (error : string, stdout : string, stderr : string) => {
var child = exec(tmpStr + executeJarCommand + ' ' + commandLineArgs, {timeout:maxWaitMillisec}, (error : string, stdout : string, stderr : string) => {
if(error !== null){
LOGGER.log("*** COBOL CHECK ERROR: " + error, LOGGER.ERROR);
}
killProcess('cobc');
LOGGER.log("child.pid: " + child.pid, LOGGER.INFO);
LOGGER.log("Cobol Check out:\n" + stdout, LOGGER.INFO)
LOGGER.log("Cobol Check log:\n" + stderr, LOGGER.INFO)
resolve(new CobParser.CobolCheckOutputParser(stdout, stderr, error))
Expand Down
12 changes: 10 additions & 2 deletions vs-code-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
],
"main": "./client/out/extension",
"contributes": {
"languages": [ {
"languages": [
{
"id": "cut",
"aliases": [
"COBOL unit test",
Expand Down Expand Up @@ -55,6 +56,11 @@
"type": "object",
"title": "COBOL unit test syntax",
"properties": {
"cut.maxWaitTime": {
"type": "number",
"default": 5000,
"description": "Max wait time before kill the process."
},
"cut.maxNumberOfProblems": {
"scope": "resource",
"type": "number",
Expand Down Expand Up @@ -186,6 +192,8 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@types/vscode-webview": "^1.57.0"
"@types/vscode-webview": "^1.57.0",
"kill-process-by-name": "^1.0.5",
"subspawn": "^1.0.2"
}
}
Loading