Skip to content

Commit 50f6e4d

Browse files
committed
Switch to sync-child-process
1 parent a72459f commit 50f6e4d

File tree

8 files changed

+9
-848
lines changed

8 files changed

+9
-848
lines changed

lib/src/compiler/sync.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// https://opensource.org/licenses/MIT.
44

55
import {Subject} from 'rxjs';
6+
import {SyncChildProcess} from 'sync-child-process';
67

78
import * as path from 'path';
89
import {
@@ -20,7 +21,6 @@ import {FunctionRegistry} from '../function-registry';
2021
import {ImporterRegistry} from '../importer-registry';
2122
import {MessageTransformer} from '../message-transformer';
2223
import {PacketTransformer} from '../packet-transformer';
23-
import {SyncProcess} from '../sync-process';
2424
import * as utils from '../utils';
2525
import * as proto from '../vendor/embedded_sass_pb';
2626
import {CompileResult} from '../vendor/sass/compile';
@@ -36,7 +36,7 @@ const initFlag = Symbol();
3636
/** A synchronous wrapper for the embedded Sass compiler */
3737
export class Compiler {
3838
/** The underlying process that's being wrapped. */
39-
private readonly process = new SyncProcess(
39+
private readonly process = new SyncChildProcess(
4040
compilerCommand[0],
4141
[...compilerCommand.slice(1), '--embedded'],
4242
{
@@ -77,7 +77,12 @@ export class Compiler {
7777

7878
/** Yields the next event from the underlying process. */
7979
private yield(): boolean {
80-
const event = this.process.yield();
80+
const result = this.process.next();
81+
if (result.done) {
82+
this.disposed = true;
83+
return false;
84+
}
85+
const event = result.value;
8186
switch (event.type) {
8287
case 'stdout':
8388
this.stdout$.next(event.data);
@@ -86,10 +91,6 @@ export class Compiler {
8691
case 'stderr':
8792
this.stderr$.next(event.data);
8893
return true;
89-
90-
case 'exit':
91-
this.disposed = true;
92-
return false;
9394
}
9495
}
9596

lib/src/sync-process/event.ts

-72
This file was deleted.

lib/src/sync-process/index.test.ts

-157
This file was deleted.

0 commit comments

Comments
 (0)