Skip to content

Commit

Permalink
fix spell multiple run issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipto Pandit (dipandit) committed Mar 4, 2021
1 parent 8ec9e89 commit 1e7c96e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Log } from 'vscode-test-adapter-util';
import { loadSnort3Tests, snort3Test, runTest } from './snort3Test';
import {myStatusBarItem, buildtool} from './main';
import * as path from 'path';
import * as PromisePool from 'es6-promise-pool';

class jobQueue {
private jobdata = new Array<TestInfo|TestSuiteInfo>();
Expand Down Expand Up @@ -212,7 +211,8 @@ export class Snort3TestAdapter implements TestAdapter {
}
else return;
}
var test_pool = new PromisePool.default(testJobProducer, buildtool.get_concurrency());
const PromisePool = require('es6-promise-pool');
var test_pool = new PromisePool(testJobProducer, buildtool.get_concurrency());
myStatusBarItem.text=`$(beaker~spin)`;
test_pool.start().then(()=>{
myStatusBarItem.text=`$(beaker)`;
Expand Down
9 changes: 8 additions & 1 deletion src/snort3Test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class snort3SpellCheck implements snort3Test {
return new Promise((resolve)=>{
testStatesEmitter.fire(<TestEvent>{ type: 'test', test: this.id, state: 'running' });

if(fs.existsSync(this.testpath+'/'+this.out_file))
fs.unlinkSync(this.testpath+'/'+this.out_file);

let find_args:string = ' -name';
if(this.type === 'source') find_args += ' *.cc -o -name *.[ch]';
else find_args += ' *.txt ! -name *CMakeLists.txt ! -name *config_changes.txt';
Expand All @@ -64,7 +67,11 @@ class snort3SpellCheck implements snort3Test {
if(!diff.pid || diff.signal) testStatesEmitter.fire(<TestEvent>{ type: 'test', test: this.id, state: 'errored' });
else if (diff.status)
testStatesEmitter.fire(<TestEvent>{ type: 'test', test: this.id, state: 'failed', tooltip:diff.stdout.toString() });
else testStatesEmitter.fire(<TestEvent>{ type: 'test', test: this.id, state: 'passed' })
else
{
testStatesEmitter.fire(<TestEvent>{ type: 'test', test: this.id, state: 'passed' });
fs.unlink(this.testpath+'/'+this.out_file,()=>{});
}
resolve();
});

Expand Down

0 comments on commit 1e7c96e

Please sign in to comment.