Skip to content

Commit 5dd240c

Browse files
committed
simplify string splitting
The simpler version does exact same thing
1 parent febb7eb commit 5dd240c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export class PythonShell extends EventEmitter{
325325

326326
if (/^Traceback/.test(text)) {
327327
// traceback data is available
328-
let lines = (''+data).trim().split(new RegExp(newline, 'g'));
328+
let lines = (''+data).trim().split(newline);
329329
let exception = lines.pop();
330330
error = new PythonShellError(exception);
331331
error.traceback = data;
@@ -376,7 +376,7 @@ export class PythonShell extends EventEmitter{
376376

377377
private receiveInternal(data:string|Buffer, emitType:'message'|'stderr'){
378378
let self = this;
379-
let parts = (''+data).split(new RegExp(newline,'g'));
379+
let parts = (''+data).split(newline);
380380

381381
if (parts.length === 1) {
382382
// an incomplete record, keep buffering

0 commit comments

Comments
 (0)