Skip to content

Commit e80f469

Browse files
committed
builtin completion
1 parent 2795de8 commit e80f469

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

app/ExternalCommand.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ class ExternalCommand extends Command {
3838
const output = data.toString();
3939
stdout += output;
4040
this.outputHandler.write(output, true);
41+
resolve(stdout);
4142
});
4243

4344
child.stderr.on('data', (data) => {
4445
const output = data.toString();
4546
stderr += output;
4647
this.outputHandler.writeError(output, true);
48+
resolve(stderr);
4749
});
4850
});
4951
}

app/OutputHandler.js

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,26 @@ class OutputHandler {
7272
writeError(message, newLine = true) {
7373
// If this is a stderr handler with redirection, write to file
7474
if (this.isStderr && this.outputFile) {
75-
try {
76-
// Ensure file is initialized first
77-
this._initializeFile();
78-
79-
// Only write if initialization succeeded
80-
if (this.fileInitialized) {
81-
const content = newLine ? message + '\n' : message;
82-
fs.appendFileSync(this.outputFile, content);
83-
} else {
84-
// Fall back to stderr console
85-
process.stderr.write(newLine ? message + '\n' : message);
86-
}
87-
} catch (error) {
75+
// Ensure file is initialized first
76+
this._initializeFile();
77+
78+
// Only write if initialization succeeded
79+
if (this.fileInitialized) {
80+
const content = newLine ? message + '\n' : message;
81+
fs.appendFileSync(this.outputFile, content);
82+
} else {
8883
// Fall back to stderr console
8984
process.stderr.write(newLine ? message + '\n' : message);
9085
}
86+
9187
} else {
9288
if(this.outputFile) {
9389
this._initializeFile();
9490
}
95-
try {
96-
if (newLine) {
97-
process.stderr.write(`${message}` + '\n');
98-
} else {
99-
process.stderr.write(message);
100-
}
101-
102-
} catch (error) {
103-
console.error('Error writing to streams:', error);
91+
if (newLine) {
92+
process.stderr.write(`${message}` + '\n');
93+
} else {
94+
process.stderr.write(message);
10495
}
10596
}
10697
}

0 commit comments

Comments
 (0)