Skip to content

Commit d844393

Browse files
authored
fix(eval): bug fix for multiline eval (#99)
Resolves the broken multiline eval bug. #97
2 parents fa99e91 + 92acede commit d844393

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/repl.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { getProcess } from './getProcess';
22

33
export const send = (command: string) => {
4-
const proc = getProcess();
5-
proc.stdin.write(command);
4+
const lines = command.split('\n');
5+
const proc = getProcess();
6+
proc.stdin.write(':{\n');
7+
lines.forEach((line) => {
8+
proc.stdin.write(line);
69
proc.stdin.write('\n');
10+
});
11+
proc.stdin.write(':}\n');
712
};
813

914
export const quit = () => {
10-
const proc = getProcess();
11-
proc.kill();
12-
}
13-
15+
const proc = getProcess();
16+
proc.kill();
17+
};

0 commit comments

Comments
 (0)