Skip to content

Commit 4894262

Browse files
committed
Change spawn to use a different way of joining strings
1 parent 7d48d00 commit 4894262

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codifycli/plugin-test",
3-
"version": "1.0.0",
3+
"version": "1.1.0-beta2",
44
"description": "Testing framework for Codify plugins with complete lifecycle testing, IPC communication, and cross-platform support",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/spawn.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,32 @@ export function spawnSafe(cmd: string, options?: SpawnOptions): Promise<SpawnRes
6464
output.push(data.toString());
6565
})
6666

67-
const resizeListener = () => {
68-
const { columns, rows } = process.stdout;
69-
mPty.resize(columns, rows);
70-
}
7167

7268
const stdinListener = (data: any) => {
7369
// console.log('stdinListener', data);
7470
mPty.write(data.toString());
7571
}
7672

77-
// Listen to resize events for the terminal window;
78-
process.stdout.on('resize', resizeListener);
7973
if (options?.stdin) {
8074
process.stdin.on('data', stdinListener)
8175
}
8276

8377
mPty.onExit((result) => {
84-
process.stdout.off('resize', resizeListener);
8578
if (options?.stdin) {
8679
process.stdin.off('data', stdinListener);
8780
}
8881

82+
const raw = stripAnsi(output.join('')).replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim();
83+
8984
if (options?.throws && result.exitCode !== 0) {
90-
reject(new Error(stripAnsi(output.join('\n').trim())));
85+
reject(new Error(raw));
9186
return;
9287
}
9388

9489
resolve({
9590
status: result.exitCode === 0 ? SpawnStatus.SUCCESS : SpawnStatus.ERROR,
9691
exitCode: result.exitCode,
97-
data: stripAnsi(output.join('\n').trim()),
92+
data: raw,
9893
})
9994
})
10095
})

0 commit comments

Comments
 (0)