Skip to content

Commit bb8d503

Browse files
committed
using exec instead of execSync
1 parent f2539e6 commit bb8d503

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/DOSBox.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Uri, workspace, window, TextDocument } from 'vscode';
22

33
import { Config } from './configration';
4-
import { execSync } from 'child_process';
4+
import { exec } from 'child_process';
55
import { AssemblerDiag } from './language/diagnose';
66
import * as nls from 'vscode-nls';
77
const localize = nls.loadMessageBundle();
@@ -30,25 +30,28 @@ export class DOSBox {
3030
//command for open dosbox
3131
let command = conf.OpenDosbox + ' -conf "' + conf.dosboxconfuri.fsPath + '" ';
3232
//exec command by terminal
33+
let callback = (error: any) => {
34+
if (error) { console.error(error); };
35+
if (diag && doc) { this.BOXdiag(conf, diag, doc); }
36+
};
3337
if (process.platform === 'win32') {
3438
if (doc) { command = 'del/Q T*.* & copy "' + doc.fileName + '" "T.ASM" & ' + command; }
35-
execSync(command + boxcommand, { cwd: conf.workpath, shell: 'cmd.exe' });
39+
exec(command + boxcommand, { cwd: conf.workpath, shell: 'cmd.exe' }, callback);
3640
}
3741
else {
3842
if (doc) { command = 'rm -f [Tt]*.*;cp "' + doc.fileName + '" T.ASM;' + command; }
39-
execSync(command + boxcommand, { cwd: conf.workpath });
43+
exec(command + boxcommand, { cwd: conf.workpath }, callback);
4044
}
41-
if (diag && doc) { this.BOXdiag(conf, diag, doc); }
4245
}
4346
public BoxOpenCurrentFolder(conf: Config, doc: TextDocument) {
4447
let folderpath: string = Uri.joinPath(doc.uri, '../').fsPath;
4548
let Ecmd: string = '-noautoexec -c "mount e \\\"' + folderpath + '\\\"" -c "mount c \\\"' + conf.path + '\\\"" -c "set PATH=%%PATH%%;c:\\masm;c:\\tasm" -c "e:"';
4649
let command = conf.OpenDosbox + ' -conf "' + conf.dosboxconfuri.fsPath + '" ';
4750
if (process.platform === 'win32') {
48-
execSync(command + Ecmd, { cwd: conf.workpath, shell: 'cmd.exe' });
51+
exec(command + Ecmd, { cwd: conf.workpath, shell: 'cmd.exe' });
4952
}
5053
else {
51-
execSync(command + Ecmd, { cwd: conf.workpath });
54+
exec(command + Ecmd, { cwd: conf.workpath });
5255
}
5356

5457
}

0 commit comments

Comments
 (0)